Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using Tiles Attributes with Custom Tags.

 
Nick Larson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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%>" />
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic