Hello,
I have problem with putting attributes in right context - my tiles
definitions look like:

<definition name=".add_product.form" path="/WEB-INF/pages/add_product.jsp"
extends=".mainLayout">
<put name="title" value="Sample Page Title" />
</definition>

<definition name=".header" path="/WEB-INF/pages/tiles/header.jsp">
<put name="title" value="Sample Page Title" />
</definition>

What I would like to achieve is:
1) I would like that .header attribute "title" was passed from
.add_product.form, so i can have only one header definition and many
rendering pages like .add_product.form, .add_product.confirm,
.add_product.thank_you and also i dont want (or other words i can't) extend
header definition
2) I tried to put header in .add_product.form as:
<definition name=".add_product.form" path="/WEB-INF/pages/add_product.jsp"
extends=".mainLayout">
<put name="title" value="Sample Page Title" />
<put name="header" value="/WEB-INF/pages/tiles/header.jsp">
</definition>

and use it in jsp page as:

<tiles:get name="header"/>

but when I used in header.jsp:

<h1><tiles:getAsString name="title"/></h1>

I got an error about lack of attr title in context:

11:38:22,134 ERROR [[action]] Servlet.service() for servlet action threw
exception
javax.servlet.jsp.JspException: ServletException in
'/WEB-INF/pages/tiles/header.jsp': Error - tag.getAsString : attribute
'title' not found in context. Check tag syntax
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(
InsertTag.java:921)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:460)
at
org.apache.jsp.WEB_002dINF.pages.add_005fproduct_jsp._jspx_meth_tiles_get_0(
org.apache.jsp.WEB_002dINF.pages.add_005fproduct_jsp:136)
at org.apache.jsp.WEB_002dINF.pages.add_005fproduct_jsp._jspService(
org.apache.jsp.WEB_002dINF.pages.add_005fproduct_jsp:77)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.jasper.servlet.JspServletWrapper.service(
JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

What should I do to put this attribute in right context - could you help me?

Best Regards,
Lee

Reply via email to