You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Robert Taylor <rt...@mulework.com> on 2003/04/30 23:30:20 UTC
RE: [Tiles] jsp:param value not being passed (SOLVED!)
Well, that only took a whole day :(
My template had several <tiles:insert .../>
before this line of code:
<%
String layout = request.getParameter("layout");
if (layout != null) {
%>
<jsp:include page="<%=layout%>" flush="false"/>
<%}%>
Moving the layout variable declaration and assignment...
<%
String layout = request.getParameter("layout");
%>
...up to the top of the template.jsp page,
the "layout" request parameter is retrieved
(as expected) and the page renders successfully.
I guess the <tiles:insert .../> were interfering
with accessing the request parameter. I'm too burnt
to try and find out why right now.
All I know is it works and I can move forward.
robert
> -----Original Message-----
> From: Robert Taylor [mailto:rtaylor@mulework.com]
> Sent: Wednesday, April 30, 2003 2:20 PM
> To: struts-user@jakarta.apache.org
> Subject: [Tiles] jsp:param value not being passed
>
>
> I want a single template which contains the look and feel "shell" for the
> application.
> It contains some nested tables which provide the format structure for the
> included
> header, title, navigation, layout, and footer. It also includes any html
> meta tags,
> javascript and css which are used globally. So if the L&F changes or if
> I need to modify the format structure of the shell, then I only
> change it in
> one place.
>
> I would like to "plug-in" multiple layouts. These layouts are merely
> snippets of HTML
> table elements which are subject to the L&F of the host template. Each
> layout contains
> a table which provides the format structure for its included content.
> Layouts are used to
> manipulate positioning of content. More specifically each layout would be
> "plugged" into
> a table cell of the master template.
>
> Here is a snippet of the my tiles-def.xml file:
>
> <tiles-definitions>
>
> <definition
> name="simpleLayout"
> path="/secure/pages/common/templates/simpleLayout.jsp">
>
> <put name="title"
> value="Default Title"
> type="string"/>
>
> <put name="header"
> value="/secure/pages/common/templates/header.jsp"
> type="page"/>
>
> <put name="navigation"
> value="/secure/pages/common/templates/navigation.jsp"
> type="page"/>
>
> <put name="footer"
> value="/secure/pages/common/templates/footer.jsp"
> type="page"/>
>
> </definition>
>
> <definition
> name="home.index"
> extends="simpleLayout">
>
> <put name="content"
> value="/secure/pages/home/content/index-content.jsp"
> type="page"/>
>
> </definition>
>
> </tiles-definitions>
>
>
>
> simpleLayout.jsp contains the following:
> <jsp:include page="/secure/pages/common/templates/template.jsp">
> <jsp:param name="layout"
> value="/secure/pages/common/templates/simple_layout_format.jsp"/>
> </jsp:include>
>
>
>
> template.jsp contains the application shell with a conditional include.
> I've left out all the other HTML elements for simplicity:
> <%
> String layout = request.getParameter("layout");
> if (layout != null) {
> %>
> <jsp:include page="<%=layout%>" flush="false"/>
> <%}%>
>
>
>
> simple_layout_format.jsp contains:
> <tiles:insert attribute="content" ignore="true"/>
>
>
>
> index.jsp contains
> <tiles:insert definition="home.index" flush="true"/>
>
>
> Here's what I expect to happen:
> -Request index.jsp
> -Tiles looks up definition for "home.index"
> -Tiles includes simpleLayout.jsp
> -JSP page includes template.jsp passing the "layout"
> url as a parameter.
> -template.jsp includes the url defined in the "layout"
> request parameter.
> -Tiles renders all attributes defined in simpleLayout.jsp
> with values in home.index definition
> -Page is rendered.
>
>
> The problem is that the parameter "layout" is not passed to template.jsp
> and I cannot figure out why.
>
> If I by-pass Tiles, then the parameter is passed as expected.
> Using Tiles, if I hard code the layout value in template.jsp the page is
> rendered
> as expected.
>
>
> Any ideas?
>
> robert
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org