You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dilip Ladhani <di...@hotmail.com> on 2005/08/25 22:15:13 UTC
Struts-Tiles Design question
I have an application built on struts and tiles. I have a design question
and would like some of your valuable opinions.
I have a huge jsp, which is broken into many includes, say abc.jsp and
includes one.jsp, two.jsp etc.
As, I mentioned I use tiles so in the config file, I have a forward element,
which is like this
<forward name="abc" path="abc" contextRelative="true"/>
The "abc" is defined in the tiles as
<put name="body-content" value="/abc.jsp" />
Now for the design question...
I am going to have to switch the includes (one.jsp, two.jsp etc) based on
some business rules like the geographical area, app type etc.
1) Should I just put this logic in the jsp (using if statements like :if
apptype = "A" use one.jsp else use one-next.jsp etc) or
2)Should I use tiles by having different action mappings based on different
business parameters(say app type) and have each mapping forward to a
different "forward" defined in tiles-def.
Also the business parameters (based on which jsp is selected) may change in
the future.
Thanks for your input
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts-Tiles Design question
Posted by Greg Reddin <gr...@fnf.com>.
On Aug 25, 2005, at 3:15 PM, Dilip Ladhani wrote:
> I have an application built on struts and tiles. I have a design
> question and would like some of your valuable opinions.
>
> I have a huge jsp, which is broken into many includes, say abc.jsp and
> includes one.jsp, two.jsp etc.
> As, I mentioned I use tiles so in the config file, I have a forward
> element, which is like this
> <forward name="abc" path="abc" contextRelative="true"/>
>
> The "abc" is defined in the tiles as
> <put name="body-content" value="/abc.jsp" />
>
> Now for the design question...
> I am going to have to switch the includes (one.jsp, two.jsp etc) based
> on some business rules like the geographical area, app type etc.
>
> 1) Should I just put this logic in the jsp (using if statements like
> :if apptype = "A" use one.jsp else use one-next.jsp etc) or
You should probably stay away from this if possible.
Have you looked at the Tiles Controller interface? You might be able
to put your business logic in a controller class. The ComponentContext
is passed into the controller and you can set attribute values, etc.
Greg
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts-Tiles Design question
Posted by Michael Rasmussen <ra...@gmail.com>.
Dilip,
The tiles controller sounds like an interesting way to do it, but I
have never used it. I agree with Nels that you should stay away from
a JSP implementation of this. I have stretched tiles pretty far as to
what it can do conditionally, and I have been very happy with it. I
would suggest using an action to make decisions about where to go, and
use tiles templates to put the right fragments in the right places.
Michael
On 8/25/05, Nels Overgaard-Cook <ne...@gmail.com> wrote:
> If you put the business logic in the JSPs, then it seems to me that you're
> essentially mixing the business and presentation layers. I would put the
> business login in an action and figure out which tile to forward to from
> there. Of course, I haven't used the Tiles Controller that Greg suggested...
>
> Nels
>
> On 8/25/05, Dilip Ladhani <di...@hotmail.com> wrote:
> >
> > I have an application built on struts and tiles. I have a design question
> > and would like some of your valuable opinions.
> >
> > I have a huge jsp, which is broken into many includes, say abc.jsp and
> > includes one.jsp, two.jsp etc.
> > As, I mentioned I use tiles so in the config file, I have a forward
> > element,
> > which is like this
> > <forward name="abc" path="abc" contextRelative="true"/>
> >
> > The "abc" is defined in the tiles as
> > <put name="body-content" value="/abc.jsp" />
> >
> > Now for the design question...
> > I am going to have to switch the includes (one.jsp, two.jsp etc) based on
> > some business rules like the geographical area, app type etc.
> >
> > 1) Should I just put this logic in the jsp (using if statements like :if
> > apptype = "A" use one.jsp else use one-next.jsp etc) or
> > 2)Should I use tiles by having different action mappings based on
> > different
> > business parameters(say app type) and have each mapping forward to a
> > different "forward" defined in tiles-def.
> >
> > Also the business parameters (based on which jsp is selected) may change
> > in
> > the future.
> >
> > Thanks for your input
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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
Re: Struts-Tiles Design question
Posted by Nels Overgaard-Cook <ne...@gmail.com>.
If you put the business logic in the JSPs, then it seems to me that you're
essentially mixing the business and presentation layers. I would put the
business login in an action and figure out which tile to forward to from
there. Of course, I haven't used the Tiles Controller that Greg suggested...
Nels
On 8/25/05, Dilip Ladhani <di...@hotmail.com> wrote:
>
> I have an application built on struts and tiles. I have a design question
> and would like some of your valuable opinions.
>
> I have a huge jsp, which is broken into many includes, say abc.jsp and
> includes one.jsp, two.jsp etc.
> As, I mentioned I use tiles so in the config file, I have a forward
> element,
> which is like this
> <forward name="abc" path="abc" contextRelative="true"/>
>
> The "abc" is defined in the tiles as
> <put name="body-content" value="/abc.jsp" />
>
> Now for the design question...
> I am going to have to switch the includes (one.jsp, two.jsp etc) based on
> some business rules like the geographical area, app type etc.
>
> 1) Should I just put this logic in the jsp (using if statements like :if
> apptype = "A" use one.jsp else use one-next.jsp etc) or
> 2)Should I use tiles by having different action mappings based on
> different
> business parameters(say app type) and have each mapping forward to a
> different "forward" defined in tiles-def.
>
> Also the business parameters (based on which jsp is selected) may change
> in
> the future.
>
> Thanks for your input
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>