What Chip suggested I had also tried (and neglected to mention in my first message). I can divine for Shirish's message that it has to do with the attributes not being in scope in the subtile.

I tried what Shirish suggested and I can now pass attributes from the JSP to the subtile. However, there's one problem. If I don't pass the attribute in the JSP, I get this error:

[ServletException in:/tiles/statusSubLayout.jsp] Cannot find bean statusBarPercent in scope request'

I tried changing the <bean:define> to <tiles:useAttribute scope="request"> but the useAttribute tag doesn't get the value from the JSP.

I would think that <tiles:importAttribute scope="request"/> in subLayout.jsp would have brought in attributes from the definition, but for some reason it's not.

Is there anything I'm doing wrong, or is there good workaround?

Thanks,

Robert

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 12, 2003 9:41 AM
To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
Subject: RE: Nested Tiles Definitions

You can insert definition inside another definition..There is no problem in that.That 
is the whole point of tiles...
But what he is missing is that the nested definition does not get the paraeters passed 
from the top level definition...

SO try this..
In the toplevel template,/tiles/subLayout.jsp, add tiles import statement as follows.
<!-- Make all attributes available in request
required for nested Definations.. -->
<tiles:importAttribute scope="request"/>
What this does is makes all the attributes passed to this definition available in 
request scope.

So now when u pass any additional attruibutes, these wil be available in request scope.
So the statusBarPercent value will be avallable in request now..Get it from there 
before using it in the jsp.../tiles/statusSubLayout.jsp
<!-- make the title key available as a java variable for use in eq:message tag -->
<bean:define id="statusPercent" name="statusBarPercent" scope="request" 
type="java.lang.String"/>

Now use this statusPercent ..


HTH.


regards,
Shirish

-----Original Message-----
From: Chip Paul [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 12, 2003 12:14 AM
To: Struts Users Mailing List
Subject: RE: Nested Tiles Definitions


I don't think you can net calls to <tiles:put> like that.


Instead try this insert:

<tiles:insert definition="site.subLayout.status" flush="true>
 <tiles:put name="statusBarPercent" value="0" />
</tiles:insert>

The whole reason you defined the site.sublayout.status definition was so you
could refer to it and it's added percent bar functionality, so go ahead and
insert it directly.

Chip



-----Original Message-----
From: Jerry Smith [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 11, 2003 4:26 PM
To: [EMAIL PROTECTED]
Subject: Nested Tiles Definitions


Hello,


I tried posting this through Yahoo! and my message wouldn't show up.  If
this gets posted multiple times, many apologies!

I'm using Struts 1.0 and the Tiles extension from
http://www.lifl.fr/~dumoulin/tiles/ .

I want to use a one definition is another definition.  Here are my
current definitions:

 <definition name="site.mainLayout.subs" path="/tiles/subLayout.jsp">
   <put name="header" value="/tiles/standardHeader.jsp" />
   <put name="menu" value="/tiles/standardMenu.jsp" />
   <put name="main.title" value="TITLE NEEDED" />
   <put name="body.sublayout" value="site.subLayout.status" />
 </definition>

 <definition name="site.subLayout.status"
path="/tiles/statusSubLayout.jsp">
   <put name="body" value="/tiles/blank.jsp" />
   <put name="statusTitleImage" value="IMAGE NEEDED" />
   <put name="statusBarPercent" value="0" />
 </definition>

Now, say I want the statusBarPercent value to be 50.  I can't figure out
how to change this value in the JSP.  I've tried:

<tiles:insert definition="site.mainLayout.subs" flush="true">
 <tiles:put name="body.sublayout" value="site.subLayout.status">
   <tiles:put name="statusBarPercent" value="50" />
 </tiles:put>
</tiles:insert>

The value remains "0".  Can someone see what I'm doing wrong or if what
I want to do is feasible?

Thanks,

Robert



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to