Terry>> Hard to tell from a snippet of an entire site but if the definition page does 
not define anything except the page.jsp and if you always have form_wrapper.jsp around 
each for then you could move form_wrapper.jsp functionality to page.jsp and simplify 
the design.  The other way to reduce is to have the functionality for form_wrapper 
.jsp in the formX.jsp.   The tiles context is only for the definition being used not 
for any embedded definitions so unless you take measures to pass attributes down tiles 
will not see them.  I pass the page definition being called for some menuing style 
changes but to do so you need to define a bean with the attribute in request scope 
then pluck it in the lower tiles definition. I have an example on my web site - if you 
look for the code for the level 3 index you will see the same technique: 
http://www.calandva.com/holmansite/do/blog/blogging.  Although I have been having a 
lot of problems with my DSL connection over the last few weeks - so email me if you 
would like more info.

If you must do the nested definitions then you can pass the inner tiles insert 
parameter as a bean and script the formX.jsp.  This is pretty ugly and Cedric or 
someone else may know a better way - I just hacked this together.  First the hack:

In form_wrapper.jsp add this line where you want form1.jsp to be inserted:
<tiles:insert name="<%= request.getAttribute("form").toString() %>" flush="true" />

Then in page.jsp you need to do two things the easy one is include form_wrapper.jsp:
<tiles:insert attribute="body"  flush="true"/>
or you could use your def calling a def routine.
Also in page.jsp include a line near the top of the page prior to any tiles:insert 
tags to create the request scope bean this will make the form visible to the next tile:
<tiles:useAttribute id="form" name="form" scope="request"/>

Now the definition can look like this:
 <definition name="page" path="page.jsp"/>

 <definition name="form_type_page" extends="page">
                <put name="body" value="form_wrapper.jsp">
        <put name="form" value="form1.jsp"/>
 </definition>

 <definition name="form_page2" extends="form_type_page">
        <put name="form" value="form2">
 </definition>

I know it is messy - but it should work.

Cal

http://www.calandva.com/            Last update 08/01/03


-----Original Message-----
From: Terry Brick [mailto:[EMAIL PROTECTED]
Sent: Friday, August 01, 2003 15:20
To: [EMAIL PROTECTED]
Subject: RE: Please Help With Simple Tiles Problem

Thanks for your response David.  Correct me if I'm
wrong, but isn't this exactly what I had in my
example?  Maybe I'm just not grasping something...
It looks to me like I'm still having to add two
<definition> blocks for each form I want to add.
Under your "form_page" definition you point to form1
-OR- form2. But in reality can't you only have one or
the other?  I have an struts action pointing to each
form so wouldn't I have to do something like...


 <definition name="page" path="page.jsp"/>

 <definition name="form_page1" extends="page">
        <put name="body" value="form1">
 </definition>

 <definition name="form_page2" extends="page">
        <put name="body" value="form2">
 </definition>

 <definition name="form1" path="form_wrapper.jsp">
    <put name="body" value="form1.jsp"/>
 <definition>

 <definition name="form2" path="form_wrapper.jsp">
    <put name="body" value="form2.jsp"/>
 <definition>


So I would have an action pointing to "form_page1" and
an action pointing two "form_page2".  But I would have
to add two definitions to my tiles-config file for
each form.  It just seems redundant to me.

Sorry if I'm being dense, your patience is much
appreciated :-)



--- David Tobey <[EMAIL PROTECTED]> wrote:
> Can you just create a generic definition for a "form
> page". Then, switch out
> what you put for the body. Like this:
>
> <definition name="page" path="page.jsp"/>
>
> <definition name="form_page" extends="page">
>       <put name="body" value="form1">
>       <-- OR: <put name="body" value="form2"> -->
> </definition>
>
> <definition name="form1" path="form_wrapper.jsp">
>    <put name="body" value="form1.jsp"/>
> <definition>
>
> <definition name="form2" path="form_wrapper.jsp">
>    <put name="body" value="form2.jsp"/>
> <definition>
>
> ... etc ...
>
> Now you must create one new definition for each
> form, but to use a different
> one, just change what you use for the body of the
> "form_page".
>
> dave
>
>
> > -----Original Message-----
> > From: Terry Brick
> [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, July 31, 2003 10:55 PM
> > To: Struts Users Mailing List
> > Subject: Re: Please Help With Simple Tiles Problem
> >
> >
> > Ok, I've finally gotten this to work.  However, I
> > don't think it's the "right" solution and it's
> > certainly not one I'm happy with.  But maybe by
> > showing how I'm getting it to work, that will
> better
> > communicate to people what I'm trying SO HARD to
> do.
> >
> > This works:
> >
> > <definition name="page" path="page.jsp"/>
> >
> > <definition name="form1" extends="page">
> >    <put name="body" value="form1a"/>
> > <definition>
> >
> > <definition name="form1a" path="form_wrapper.jsp">
> >    <put name="form-body" value="form1.jsp"/>
> > </definition>
> >
> > So this gives me...
> > <page.jsp>
> >   <form_wrapper.jsp>
> >     <form1.jsp/>
> >   </form_wrapper.jsp>
> > </page.jsp>
> >
> > The problem is that "form1.jsp" will not always be
> > "form1.jsp".  I want to be able to swap that for a
> > "form2.jsp", "form3.jsp", etc.  Using this method,
> I
> > would have to add TWO definitions into the
> > tile-defs.xml for each new form I wanted!  (form2,
> > form2a, form3, form3a, etc)
> > There must be a better way where I only have to
> add a
> > single definition for each new form.  Any ideas?
> > Advice is much appreciated. Thanks.
> >
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> > http://sitebuilder.yahoo.com
> >
>


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
  
Learn more about Paymentech's payment processing services at www.paymentech.com
THIS MESSAGE IS CONFIDENTIAL.  This e-mail message and any attachments are proprietary 
and confidential information intended only for the use of the recipient(s) named 
above.  If you are not the intended recipient, you may not print, distribute, or copy 
this message or any attachments.  If you have received this communication in error, 
please notify the sender by return e-mail and delete this message and any attachments 
from your computer.

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

Reply via email to