struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "matthew c. mead" <mm...@goof.com>
Subject odd tiles behavior with tile parameters
Date Mon, 07 Jul 2003 12:45:43 GMT
I'm trying to use Tiles for a couple different things and seeing
some bizarre behavior.  I've not looked into its source too
thoroughly at this point, but would be willing to do so to help
figure this out.

I use tile parameters in a couple different ways:

<definition name="ServiceWithoutSearchHeader" path="/include/header_without_search.jsp"
/>
<definition name="ServiceWithoutSearchLeftNav" path="/include/left_nav.jsp" />
<definition name="ServiceWithoutSearchFooter" path="/includes/footer.inc" />
<definition name="ServiceWithoutSearchDebug" path="/includes/debug_output.jsp" />
<definition name="ServiceWithoutSearch">
  <put name="header" value="ServiceWithoutSearchHeader" />
  <put name="leftnav" value="ServiceWithoutSearchLeftNav" />
  <put name="footer" value="ServiceWithoutSearchFooter" />
  <put name="debug" value="ServiceWithoutSearchDebug" />
  <put name="navNode" value="Maintenance" type="string" />
  <put name="title" value="Service" direct="true" />
</definition>

So you can see I use them to include tiles within a tile, as well
as some parameters.  When I want to include one of those JSPs in
the output, I simply use <tiles:insert>.

The other parameters in that outer definition (navNode, title), I
pass along to some specific subtiles - the header and the leftnav:

<tiles:insert attribute="header">
  <tiles:put name="title" beanName="title" beanScope="tile" />
  <tiles:put name="navNode" beanName="navNode" beanScope="tile" />
</tiles:insert>

In the sub-tiles I access the title like so:

<tiles:get name="title" />

and it works fine.

However, the navNode I need to use programmatically:

<tiles:useAttribute name="navNode" classname="java.lang.String" />

If I specify direct="true" or type="string" for navNode in the
definition I get a ClassCastException with the above line in my
JSP.  However, the way I'm currently putting it in the definition,
I cannot use it within a <tiles:get> tag because it assumes it is
not direct and tries to read a file.

Is there one method I can use for defining these parameters so they
are consistent or am I stuck with the different definition entries
based on how I use them?

Thanks!



-matt

-- 
matthew c. mead

http://www.goof.com/~mmead/

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message