struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wo_shi_ni_ba_ba <wo_shi_ni_ba...@yahoo.com>
Subject Re: tiles:insert and tiles:put an attribute and the import it to request scope
Date Tue, 08 Mar 2005 18:30:58 GMT
Tim,
thanks for the example.  What I really want is to
modify the value of the attribute title from
content.jsp and then acess this attribute from
somepage.jsp.  How can this be achieved?
thank you!


--- Tim Christopher <tim.christopher@gmail.com> wrote:
> Not sure if this is what you're asking but here's a
> quick example that
> shows how to access the information stored in the
> tiles-defs.xml in a
> file other than your layout page....
> 
> # Extract from tiles-defs.xml #
> --------------------------------------------
> <definition name=".public.welcome"
> path="/WEB-INF/pages/layout.jsp">
>   <put name="title" value="My home page"/>
>   <put name="content"
> value="/WEB-INF/pages/content.jsp"/>
>   <put name="somepage"
> value="/WEB-INF/pages/somepage.jsp"/>
> </definition>
> 
> # Extract from layout.jsp #
> -------------------------------------
> <tiles:importAttribute/>
> <h1><tiles:getAsString name="title"/></h1>
> <tiles:insert attribute="content">
>   <tiles:put name="somepage" value="${somepage}"/>
> </tiles:insert>
> 
> # Extract from content.jsp #
> ------------------------------------
> <tiles:importAttribute name="somepage"/>
> <tiles:insert attribute="somepage"/>
> 
> 
> Hope that helps,
> 
> Tim Christopher
> 
> 
> 
> On Mon, 7 Mar 2005 10:55:49 -0800 (PST), Jonathan M
> Z
> <wo_shi_ni_ba_ba@yahoo.com> wrote:
> > dear folks,
> > I know that I can insert an attribute into a  jsp
> page
> > by using tiles:insert and tiles put as the
> following:
> > <tiles:insert page="/basic/myLayout.jsp"
> > flush="true">
> >            <tiles:put name="param1"  value="My
> first
> > page" />
> >             <tiles:put name="nav"
> value="/common/nav.jsp" />
> > 
> > </tiles:insert>
> > but what if I want to get the value of this
> attribute
> > from one of its sub jsp pages(eg. nav.jsp)
> > I have tried using <tiles:importAttribute
> > scope="request"/> to import all the tiles
> attributes
> > into the request scope.  But it doesn't seem like
> the
> > attributes get imported into the request scope
> > when I print out all the attribute names from the
> > request as the following in nav.jsp:
> > <tiles:importAttribute scope="request"/>
> > <%
> >        Enumeration e=request.getAttributeNames();
> >        while(e.hasMoreElements()){
> >                out.println(e.nextElement()+ "
> <>");
> >        }
> > %>
> > neither was I able to use<bean:write
> name="param1"/>
> > in nav.jsp
> > 
> > what's wrong?
> > 
> > thanks
> > 
> > __________________________________
> > Celebrate Yahoo!'s 10th Birthday!
> > Yahoo! Netrospective: 100 Moments of the Web
> > http://birthday.yahoo.com/netrospective/
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> > 
> >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


	
		
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/

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


Mime
View raw message