aspose file tools*
The moose likes Struts and the fly likes Using Tiles Attributes with Custom Tags. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Using Tiles Attributes with Custom Tags." Watch "Using Tiles Attributes with Custom Tags." New topic
Author

Using Tiles Attributes with Custom Tags.

Nick Larson
Greenhorn

Joined: Apr 21, 2004
Posts: 7
Hello All..

I am trying to use on of my tiles as dynamic content. I guess the custom tag doesn't like the brackets, but am I am more interested if there is a "trick" to get this to work.

tiles-def.xml
===============
<definition name="myPage" path="/tiles/baseLayout.jsp" >
<put name="title" value="Main Title" />
<put name="menuTitle" value="Menu Title" />
</definition>


baseLayout.jsp
===============
<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>
<%@ taglib uri="/MenuTag" prefix="mt" %>

<html>
<head>
<title><tiles:getAsString name="title"/></title>
</head>

<body>
<mt:menu title=<tiles:getAsString name="menuTitle"/> />
</body>
</html>
Nick Larson
Greenhorn

Joined: Apr 21, 2004
Posts: 7
I have tried something like this in baseLayout.jsp as well. I thought this would work, but I must be missing something.

<tiles:useAttribute id="lMenuTitle" name="menuTitle" />
<mt:menu title="<%lMenuTitle%>" />
Nick Larson
Greenhorn

Joined: Apr 21, 2004
Posts: 7
Ok...5 more minutes, had it figured out....

I was close with my last try....

Here is what I did...

<tiles:useAttribute className="String" id="lMenuTitle" name="menuTitle" />
<mt:menu title="<%=lMenuTitle%>" />
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using Tiles Attributes with Custom Tags.
 
Similar Threads
Tiles Context is there and is not there?
Legal to put a bean:write inside tiles-defs.xml?
confusion on struts tile
Struts1 tiles
How to access to ValueStack from xml?