tiles2 - org.apache.tiles.TilesException: Attribute 'header' not found in struts2 -


i used tiles in struts application. getting error like

servlet.service() servlet [jsp] in context path [/sample_struts2] threw exception [javax.servlet.servletexception: javax.servlet.jsp.jspexception: error executing tag: attribute 'header' not found.] root cause 

struts.xml

 <package name="tiles-sample" extends="tiles-default"> <result-types>     <result-type name="tiles"         class="org.apache.struts2.views.tiles.tilesresult" /> </result-types>  <action name="*link" method="{1}" class="com.sample.tilesaction">     <result name="welcome" type="tiles">welcome</result>     <result name="friends" type="tiles">friends</result>     <result name="office" type="tiles">office</result> </action> 

web.xml

    <context-param>        <param-name>org.apache.tiles.impl.basictilescontainer.definitions_config</param-name>        <param-value>/web-inf/tiles.xml</param-value>    </context-param>        <listener>         <listener-class>org.apache.struts2.tiles.strutstileslistener</listener-class>    </listener>        <filter>       <filter-name>struts2</filter-name>       <filter-class>org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter</filter-class>    </filter>     <filter-mapping>       <filter-name>struts2</filter-name>       <url-pattern>/*</url-pattern>    </filter-mapping> 

tiles.xml

<!doctype tiles-definitions public    "-//apache software foundation//dtd tiles configuration 2.0//en"    "http://tiles.apache.org/dtds/tiles-config_2_0.dtd">  <tiles-definitions>     <definition name="helloworld" template="/tilessample.jsp">       <put-attribute name="header" value="/header.jsp"/>       <put-attribute name="menu" value="/menu.jsp"/>       <put-attribute name="body" value="/helloworld.jsp"/>       <put-attribute name="footer" value="/footer.jsp"/>         </definition> </tiles-definitions> 

tilesample.jsp

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd">  <html> <body>     <table border="1" cellpadding="2" cellspacing="2" align="center">         <tr>             <td height="30" colspan="2"><tiles:insertattribute name="header" />             </td>         </tr>         <tr>             <td height="250"><tiles:insertattribute name="menu" /></td>             <td width="350"><tiles:insertattribute name="body" /></td>         </tr>         <tr>             <td height="30" colspan="2"><tiles:insertattribute name="footer" />             </td>         </tr>     </table> </body> </html> 

and log error

org.apache.tiles.jsp.taglib.rolesecuritytagsupport doendtag severe: error executing tag: attribute 'header' not found. org.apache.tiles.tilesexception: attribute 'header' not found.     @ org.apache.tiles.jsp.taglib.insertattributetag.render(insertattributetag.java:112)     @ org.apache.tiles.jsp.taglib.rendertagsupport.execute(rendertagsupport.java:154)     @ org.apache.tiles.jsp.taglib.rolesecuritytagsupport.doendtag(rolesecuritytagsupport.java:75)     @ org.apache.tiles.jsp.taglib.containertagsupport.doendtag(containertagsupport.java:80)     @ org.apache.jsp.tiles_jsp._jspx_meth_tiles_005finsertattribute_005f0(tiles_jsp.java:115)     @ org.apache.jsp.tiles_jsp._jspservice(tiles_jsp.java:67)     @ org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70)     @ javax.servlet.http.httpservlet.service(httpservlet.java:722)     @ org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:419)     @ org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:391)     @ org.apache.jasper.servlet.jspservlet.service(jspservlet.java:334)     @ javax.servlet.http.httpservlet.service(httpservlet.java:722)     @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:304)     @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:210)     @ org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter.dofilter(strutsprepareandexecutefilter.java:88)     @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:243)     @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:210)     @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:240)     @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:164)     @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:462)     @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:164)     @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:100)     @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:562)     @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:118)     @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:395)     @ org.apache.coyote.http11.http11processor.process(http11processor.java:250)     @ org.apache.coyote.http11.http11protocol$http11connectionhandler.process(http11protocol.java:188)     @ org.apache.coyote.http11.http11protocol$http11connectionhandler.process(http11protocol.java:166)     @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:302)     @ java.util.concurrent.threadpoolexecutor$worker.runtask(threadpoolexecutor.java:886)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:908)     @ java.lang.thread.run(thread.java:662) 

i'm using struts 2.3.1.2 version. don't know exact problem. can body this?

in struts.xml :   <action name="*link" method="{1}" class="com.sample.tilesaction">     <result name="welcome" type="tiles">helloworld</result>     <result name="friends" type="tiles">friends</result>     <result name="office" type="tiles">office</result> </action>  in tile.xml   <definition name="helloworld" template="/tilessample.jsp">     <put-attribute name="header" value="/header.jsp"/>          <put-attribute name="menu"   value="/menu.jsp"/>       <put-attribute name="body"   value="/body.jsp"/>       <put-attribute name="footer"   value="/footer.jsp"/>   </definition>   <definition name="friend" extends="helloworld">          <put-attribute name="header" value="/header1.jsp"/>          <put-attribute name="menu"   value="/menu1.jsp"/>       <put-attribute name="body"   value="/body1.jsp"/>       <put-attribute name="footer"   value="/footer1.jsp"/>   </definition>   <definition name="office" extends="helloworld">          <put-attribute name="header" value="/header2.jsp"/>          <put-attribute name="menu"   value="/menu2.jsp"/>       <put-attribute name="body"   value="/body2.jsp"/>       <put-attribute name="footer"   value="/footer2.jsp"/>   </definition>   

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -