You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mt...@netscape.net on 2002/09/17 22:41:44 UTC

Re: Tile and parameters use...

Cedric and/or any Tiles Users, 

I've looked through the documentation and have an idea of how to do what I want, but I'm not quite there yet... can you advise?

I have a main document definition:

  <definition name="main" path="/layout/main.jsp">
    <put name="header" value="/layout/header.jsp"/>
    <put name="menu" value="main.menu"/>
    <put name="body" value="/layout/body.jsp"/>
  </definition>

I want to pass parameters to the menu.jsp, so I can define the menu as follows:

  <definition name="main.menu" path="/layout/menu.jsp">
    <put name="section" value="string1"/>
    <put name="subsection" value="string2"/>
  </definition>

Now when I go to define each of my application pages based on my main page definition, how can I pass the menu parameters? This is where I lose it..

  <definition name="page1" extends="main">
    <put name="main.menu" ....???? 
        insert section value = "string1"
        insert subsection value = "string2"
    <put name="body" value="/somefolder/pageone.jsp"/>
  </definition>

On the menu.jsp, I want to do an <tiles:importAttribute> or <tiles:getAsString> call which gets the "section" and "subsection" parameters.

Please help :)
Marcella


__________________________________________________________________
The NEW Netscape 7.0 browser is now available. Upgrade now! http://channels.netscape.com/ns/browsers/download.jsp 

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tile and parameters use...

Posted by Cedric Dumoulin <ce...@apache.org>.
    Hi,

   Sorry for this late answer, I am abroad since 2 weeks, and have some 
trouble with my mails.

    I see different solutions to your problem:
Sol 1:
    Define different menu definition, and use them in your page definition:

    <definition name="main.menu2" extends="main.menu">
      <put name="section" value="string1"/>
      <put name="subsection" value="string2"/>
    </definition>

    <definition name="page1" extends="main">
      <put name="main.menu2" />
      <put name="body" value="/somefolder/pageone.jsp"/>
    </definition>

Sol 2:
    Provide menu parameters to main layout, and let the layout pass
parameters to your menu:

    <definition name="page1" extends="main">
      <put name="menu.section" value="string1"/>
      <put name="menu.subsection" value="string2"/>
      <put name="body" value="/somefolder/pageone.jsp"/>
    </definition>

in your /layout/main.jsp:
...
<tiles:insert attribute="menu" >
    <tiles:put beanName="menu.section" beanScope="tiles"/>
    <tiles:put beanName="menu.subsection" beanScope="tiles"/>
</tiles:insert >
...

     Cedric


mtStruts@netscape.net wrote:

  >Cedric and/or any Tiles Users,
  >
  >I've looked through the documentation and have an idea of how to do
what I want, but I'm not quite there yet... can you advise?
  >
  >I have a main document definition:
  >
  >  <definition name="main" path="/layout/main.jsp">
  >    <put name="header" value="/layout/header.jsp"/>
  >    <put name="menu" value="main.menu"/>
  >    <put name="body" value="/layout/body.jsp"/>
  >  </definition>
  >
  >I want to pass parameters to the menu.jsp, so I can define the menu as
follows:
  >
  >  <definition name="main.menu" path="/layout/menu.jsp">
  >    <put name="section" value="string1"/>
  >    <put name="subsection" value="string2"/>
  >  </definition>
  >
  >Now when I go to define each of my application pages based on my main
page definition, how can I pass the menu parameters? This is where I
lose it..
  >
  >  <definition name="page1" extends="main">
  >    <put name="main.menu" ....????
  >        insert section value = "string1"
  >        insert subsection value = "string2"
  >    <put name="body" value="/somefolder/pageone.jsp"/>
  >  </definition>
  >
  >On the menu.jsp, I want to do an <tiles:importAttribute> or
<tiles:getAsString> call which gets the "section" and "subsection"
parameters.
  >
  >Please help :)
  >Marcella
  >
  >
  >__________________________________________________________________
  >The NEW Netscape 7.0 browser is now available. Upgrade now!
http://channels.netscape.com/ns/browsers/download.jsp
  >
  >Get your own FREE, personal Netscape Mail account today at
http://webmail.netscape.com/
  >
  >--
  >To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
  >For additional commands, e-mail:
<ma...@jakarta.apache.org>
  >
  >
  >
  >





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>