struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandeep Takhar <sandeep_tak...@yahoo.com>
Subject Re: odd tiles behavior with tile parameters
Date Mon, 07 Jul 2003 15:05:57 GMT
The docs on useAttribute seem do not mention that it
will honour the "type" attribute.  

Obviously it is not a string when placed as a put. 
This would cause the class cast.

What is the cast exception.  It should specify what it
thinks it is?  

There is a getAsString method as well, but I don't
know if this will help you...


sandeep
--- "matthew c. mead" <mmead@goof.com> wrote:
> Thanks for the follow-up - I will try "String".
> 
> My problem really isn't with the attributes I'm
> specifying as
> direct="true" or type="string", it's with the one
> (navNode from
> my example) that I must specifically leave off the
> type/direct
> attributes in order for it to work with the
> useAttribute tag:
> 
> <tiles:useAttribute name="navNode"
> classname="java.lang.String" />
> 
> If I specify direct/type for navNode I get
> ClassCastExceptions
> when my JSP runs with the above tag.
> 
> It seems if there is a bug, it's with the
> useAttribute tag
> implementation or the put tag implementation.
> 
> Any other ideas?
> 
> Thanks again.
> 
> 
> 
> -matt
> 
> On Mon, Jul 07, 2003 at 06:07:33AM -0700, Sandeep
> Takhar wrote:
> > Not sure if this is what you are after, but
> according
> > to the docs it says that tiles:get will respect
> the
> > "type" parameter.  So maybe this is a bug.
> > 
> > >From the docs:
> > 
> > <--
> > If 'direct=true' content is 'string', if
> > 'direct=false', content is 'page'
> > 
> > 
> > Specify content type: string, page, template or
> > definition. 
> > String : Content is printed directly. 
> > page | template : Content is included from
> specified
> > URL. Name is used as an URL. 
> > definition : Value is the name of a definition
> defined
> > in factory (xml file). Definition will be searched
> in
> > the inserted tile, in a <template:insert
> > attribute="attributeName"> tag, where
> 'attributeName'
> > is the name used for this tag. 
> > -->
> > maybe it is case sensitive 'String' instead of
> > 'string'?
> > 
> > 
> > 
> > 
> > sandeep
> > --- "matthew c. mead" <mmead@goof.com> wrote:
> > > 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
> > > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> > http://sbc.yahoo.com
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> > 
> 
> -- 
> 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
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
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