本文整理汇总了Java中org.apache.struts.tiles.TilesUtil类的典型用法代码示例。如果您正苦于以下问题:Java TilesUtil类的具体用法?Java TilesUtil怎么用?Java TilesUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TilesUtil类属于org.apache.struts.tiles包,在下文中一共展示了TilesUtil类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processAsDefinitionOrURL
import org.apache.struts.tiles.TilesUtil; //导入依赖的package包/类
/**
* Try to process name as a definition, or as an URL if not found.
* @param name Name to process.
* @return appropriate TagHandler
* @throws JspException InstantiationException Can't create requested controller
*/
public TagHandler processAsDefinitionOrURL(String name)
throws JspException {
try {
ComponentDefinition definition =
TilesUtil.getDefinition(
name,
pageContext.getRequest(),
pageContext.getServletContext());
if (definition != null) {
return processDefinition(definition);
}
} catch (DefinitionsFactoryException ex) {
// silently failed, because we can choose to not define a factory.
}
// no definition found, try as url
return processUrl(name);
}
示例2: doStartTag
import org.apache.struts.tiles.TilesUtil; //导入依赖的package包/类
/**
* Do start tag.
*/
public int doStartTag() throws JspException
{
DefinitionsFactory factory = TilesUtil.getDefinitionsFactory(pageContext.getRequest(),pageContext.getServletContext());
if(factory != null )
return SKIP_BODY;
DefinitionsFactoryConfig factoryConfig = new DefinitionsFactoryConfig();
factoryConfig.setFactoryClassname( classname );
factoryConfig.setDefinitionConfigFiles( filename );
try
{
factory = TilesUtil.createDefinitionsFactory(pageContext.getServletContext(), factoryConfig);
}
catch( DefinitionsFactoryException ex )
{
ex.printStackTrace();
throw new JspException( ex.getMessage() + " See console for details" );
}
return SKIP_BODY;
}
示例3: execute
import org.apache.struts.tiles.TilesUtil; //导入依赖的package包/类
/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it),
* with provision for handling exceptions thrown by the business logic.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request (if any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
* @exception Exception if the application business logic throws
* an exception
* @since Struts 1.1
*/
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
{
response.setContentType("text/plain");
PrintWriter writer = response.getWriter();
try {
ServletContext context = getServlet().getServletContext();
DefinitionsFactory factory = TilesUtil.getDefinitionsFactory(request, context );
writer.println( factory.toString() );
} catch (Exception e) {
writer.println("FAIL - " + e.toString());
getServlet().log("ReloadAction", e);
}
writer.flush();
writer.close();
return (null);
}
示例4: processAsDefinitionOrURL
import org.apache.struts.tiles.TilesUtil; //导入依赖的package包/类
/**
* Try to process name as a definition, or as an URL if not found.
* @param name Name to process.
* @return appropriate TagHandler
* @throws JspException InstantiationException Can't create requested controller
*/
public TagHandler processAsDefinitionOrURL(String name)
throws JspException {
try {
ComponentDefinition definition =
TilesUtil.getDefinition(
name,
pageContext.getRequest(),
pageContext.getServletContext());
if (definition != null) {
return processDefinition(definition);
}
} catch (DefinitionsFactoryException ex) {
// silently failed, because we can choose to not define a factory.
}
// no definition found, try as url
return processUrl(name);
}
示例5: doStartTag
import org.apache.struts.tiles.TilesUtil; //导入依赖的package包/类
/**
* Do start tag.
*/
public int doStartTag() throws JspException
{
DefinitionsFactory factory =
TilesUtil.getDefinitionsFactory(pageContext.getRequest(),
pageContext.getServletContext());
if(factory != null )
return SKIP_BODY;
DefinitionsFactoryConfig factoryConfig = new DefinitionsFactoryConfig();
factoryConfig.setFactoryClassname( classname );
factoryConfig.setDefinitionConfigFiles( filename );
try
{
factory = TilesUtil.createDefinitionsFactory(
pageContext.getServletContext(), factoryConfig);
}
catch( DefinitionsFactoryException ex )
{
ex.printStackTrace();
throw new JspException( ex );
}
return SKIP_BODY;
}
示例6: execute
import org.apache.struts.tiles.TilesUtil; //导入依赖的package包/类
/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it),
* with provision for handling exceptions thrown by the business logic.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request (if any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
* @exception Exception if the application business logic throws
* an exception
* @since Struts 1.1
*/
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
{
response.setContentType("text/plain");
PrintWriter writer = response.getWriter();
try {
ServletContext context = getServlet().getServletContext();
DefinitionsFactory factory =
TilesUtil.getDefinitionsFactory(request, context );
writer.println( factory.toString() );
} catch (Exception e) {
writer.println("FAIL - " + e.toString());
getServlet().log("ReloadAction", e);
}
writer.flush();
writer.close();
return (null);
}
示例7: doInclude
import org.apache.struts.tiles.TilesUtil; //导入依赖的package包/类
/**
* Do an include of specified page.
* This method is used internally to do all includes from this class. It delegates
* the include call to the TilesUtil.doInclude().
* @param page The page that will be included
* @throws ServletException - Thrown by call to pageContext.include()
* @throws IOException - Thrown by call to pageContext.include()
*/
protected void doInclude(String page)
throws ServletException, IOException {
TilesUtil.doInclude(page, pageContext);
}
示例8: doInclude
import org.apache.struts.tiles.TilesUtil; //导入依赖的package包/类
/**
* Do an include of specified page.
* This method is used internally to do all includes from this class. It delegates
* the include call to the TilesUtil.doInclude().
* @param page The page that will be included
* @param flush If the writer should be flushed before the include
* @throws ServletException - Thrown by call to pageContext.include()
* @throws IOException - Thrown by call to pageContext.include()
*/
protected void doInclude(String page, boolean flush)
throws ServletException, IOException {
TilesUtil.doInclude(page, pageContext, flush);
}
示例9: createDefinitionsFactory
import org.apache.struts.tiles.TilesUtil; //导入依赖的package包/类
/**
* Create the Tiles DefinitionsFactory and expose it to the ServletContext.
* @param factoryConfig the configuration for the DefinitionsFactory
* @return the DefinitionsFactory
* @throws DefinitionsFactoryException if an error occurs
*/
protected DefinitionsFactory createDefinitionsFactory(DefinitionsFactoryConfig factoryConfig)
throws DefinitionsFactoryException {
return TilesUtil.createDefinitionsFactory(getServletContext(), factoryConfig);
}