You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ken <ke...@aerose.com> on 2010/09/13 20:40:07 UTC
Control UI via GET parameters
As a requirement I must be able to change the UI on a per request
basis... a specific case would be including or omitting a left
navigation bar. The parameters will always be passed with GET.
Currently I am using Tiles and JSP's for composition.
What I think would work is if I create a UI class and have an
interceptor match all parameters of the pattern "UI.*" and use this
class as a partial model, which will be added to the request scope along
with the action's model. Then when the JSP's render they will consult
the members of UI class as they would the members of the Action... and
do what they're supposed to do, render the side bar, don't render the
side bar...
For questions of you:
Is this a reasonable way to approach this? Is there already a way to do
this with struts 2 or am I best writing my own interceptor?
Re: Control UI via GET parameters
Posted by Ken <ke...@aerose.com>.
Never mind, chain does exactly what I need. I'm just going to require
they use
a special action and supply the target action as a parameter and throw
the UI parameters and target action parameters on the url they'll
construct.
My issue was although realizing that chain would pass on the state of
the current
action I thought for some reason that it would wipe out the rest of the
parameters
before passing it on to the next action... which isn't the case, and
gladly so as it does
make much more sense this way. Another case of... it was way easier
than I thought.
On Mon, 2010-09-13 at 12:40 -0600, Ken wrote:
> As a requirement I must be able to change the UI on a per request
> basis... a specific case would be including or omitting a left
> navigation bar. The parameters will always be passed with GET.
>
> Currently I am using Tiles and JSP's for composition.
>
> What I think would work is if I create a UI class and have an
> interceptor match all parameters of the pattern "UI.*" and use this
> class as a partial model, which will be added to the request scope along
> with the action's model. Then when the JSP's render they will consult
> the members of UI class as they would the members of the Action... and
> do what they're supposed to do, render the side bar, don't render the
> side bar...
>
> For questions of you:
> Is this a reasonable way to approach this? Is there already a way to do
> this with struts 2 or am I best writing my own interceptor?