Hi,
I'm rather stuck with a simple tile scope/variable thing (well I think it must be simple).
I have a tiles def – say
<definition name="main.layout" path="/mainLayout.jsp">
<put name="title" value=""/>
<put name="sectionStr" value="30"/>
<put name="toolbarStr" value="0"/>
<put name="menu" value="/menu.jsp"/>
<put name="header" value="/header.jsp"/>
<put name="body" value=""/>
<put name="footer" value="/footer.jsp" />
I get “Error - tag.getAsString : attribute 'title' not found in context.” as the error. But I thought I'd set it into request scope. I also tried using request.getAttribute to get it but that always seems to return null.
Thanks,
Fred
-
tiles scope and stuff - please help! (3 messages)
- Posted by: Fred Bloggs
- Posted on: June 17 2005 08:22 EDT
Threaded Messages (3)
- Extend main.layout by Biswa Das on June 17 2005 11:13 EDT
- Extend main.layout by Fred Bloggs on June 17 2005 11:57 EDT
- jsp:include by Biswa Das on June 17 2005 02:47 EDT
- Extend main.layout by Fred Bloggs on June 17 2005 11:57 EDT
-
Extend main.layout[ Go to top ]
- Posted by: Biswa Das
- Posted on: June 17 2005 11:13 EDT
- in response to Fred Bloggs
Extend main.layout and set your values for title and body.
and forward your request to your subtile.
If you forward any request to main.layout most likely it willn ot work -
Extend main.layout[ Go to top ]
- Posted by: Fred Bloggs
- Posted on: June 17 2005 11:57 EDT
- in response to Biswa Das
Thanks for the reply. I've extended the mainlayout to
<definition name="inbox" extends="main.layout">
<put name="toolbarStr" value="1"/>
<put name="title" value="Inbox"/>
<put name="body" value="/inbox.jsp"/>
</definition>
Then in mainlayout.jsp I use
<tiles:useAttribute id="title" name="title" ignore="true" scope="request" classname="java.lang.String" />
I can do <tiles:getAsString name="title"/> here fine and I thought setting the scope to request here would mean that the subtiles could grab the value
But in header.jsp a reference to <tiles:getAsString name="title"/> generates the same error (“Error - tag.getAsString : attribute 'title' not found in context.”)... -
jsp:include[ Go to top ]
- Posted by: Biswa Das
- Posted on: June 17 2005 14:47 EDT
- in response to Fred Bloggs
tiles are driven in the concept of jsp:include not static include concept. So as per my understanding of struts you have to use different taglib to extract the value of the request attribute