struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Christopher <tim.christop...@gmail.com>
Subject Re: Tiles - a reality check (contains many details) - Am I using this thing right?
Date Wed, 23 Feb 2005 01:38:21 GMT
>> <definition name="page.login" extends="base.definition">
>>     <put name="title" value="Login Page" />
>>     <put name="body" value="/jsp/loginBody.jsp" />
>> </definition>

I believe it is convention to place a leading . at the start of the
definition's name.  This signifies where the leading / would be if you
used slashes.  It'll work perfectly well without it though - just
remember that if you change it you will need to update all of your
paths in the struts config file too.

You may also find it useful to use
'org.apache.struts.actions.ForwardAction'.  This action will
automatically forward to the path / definition given as the parameter,
ie. the code below loads the page associated to the definition of
.public.welcome in the tiles configuration file.

  <action
     path="/welcome"
     type="org.apache.struts.actions.ForwardAction"
     parameter=".public.welcome">
   </action>


Tim Christopher

On Tue, 22 Feb 2005 13:58:12 -0800, Scott Piker <scott.piker@xede.com> wrote:
> > When using tiles this way, does this mean that any forward I define in
> > my struts-config.xml should be a valid Tiles Definition?
> >
> > Would that then imply that every page in my application is specified
> > by a tiles Definition, and that's how I GET to any given page?
> 
> Yes, that's typically the way you would want to do it, but you're by no means forced
to do it that way.  Your struts-config can forward to a mixture of tiles-defs, JSPs, etc...
but I prefer to keep everything tiles-centric.
> 
> > example: I want to create a Profile Editing page, so I create
> > profileEditBody.jsp and a NEW definition in the tiles-defs file
> > specifying only the TITLE and BODY ..a la
> >
> > <definition name="page.profile.edit" extends="base.definition">
> >      <put name="title" value="Edit Profile Page" />
> >      <put name="body" value="/jsp/profileEditBody.jsp" />
> > </definition>
> >
> > Bue heres the question... how do I call this thing from an Action
> > Class?!?!?! Argh!!!!
> 
> just refer to the definition name in the action mapping your struts-config:
> 
> <action path="/showProfileEdit" type=... >
>  <forward name="success" path="page.profile.edit"/>
> </action>
> 
> HTH,
> - Scott
> 
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message