----- Original Message -----
From: "Struts-dev Newsgroup" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 04, 2002 7:55 PM
Subject: Re: Servlet 2.3 filter


> Subject: Re: Servlet 2.3 filter
> From: Bill Wohler <[EMAIL PROTECTED]>
>  ===
> "Craig R. McClanahan" <[EMAIL PROTECTED]> writes:
> >   - It's commonly necessary to generate slightly different HTML for
> >     different user agents, to deal with the inevitable differences.
> >     One approach is to build the knowledge of these differences into
> >     every tag that renders HTML.  A different approach would be to
> >     generate some agent-neutral rendering of the output in XML, and then
> >     apply an agent-specific transformation in a response wrapper.
>
>   Oh yeah, that would be nice. The "different user agents" applies to
>   web browsers and phone browsers alike. I currently maintain two
>   trees since the HTML and WML is so different. Within the phone side,
>   there are large differences in some widgets which I plan to hide in
>   custom tags (normally, I keep markup out of tags). However, what you
>   suggest would be preferable.
>
>   I'm also planning on using filters to do "resource switching" and
>   I'm not sure yet how this will work. A given page "foo.jsp" might be
>   found in any number of places depending on:
>
>   - the variant in use (companyA, companyB, etc.)
>   - the user's locale (en_US, etc.)
>   - the markup (HTML, WML, etc.)
>
>   I was planning on creating a servlet filter which would intercept
>   the request with the virtual page (foo.jsp), find the appropriate
>   page, and forward the request with the actual page
>   (companyA/en_US/HTML/foo.jsp).
>
>   Thoughts?

One way I have seen this addressed is to use an Action to make the decision.
Instead of forwarding to "foo.jsp" directly, you forward to another action.
That action composes the path to the appropriate JSP page, using knowledge
of the base page name and the variant, locale and markup, and then forwards
to that path.

Alternatively, you could extend Action and add a method to perform the path
composition. Then you would call this new method (composeForward(), perhaps)
at the end of your execute() method, instead of making the typical call to
mapping.findForward(). This approach has the advantage that composeForward()
can take advantage of any logical forwards you have defined for the action,
so that those forwards can be used to provide the base name for JSP page
(e.g. foo.jsp).

--
Martin Cooper


>
> --
> Bill Wohler <[EMAIL PROTECTED]>  http://www.newt.com/wohler/  GnuPG
ID:610BD9AD
> Maintainer of comp.mail.mh FAQ and mh-e. Vote Libertarian!
> If you're passed on the right, you're in the wrong lane.
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>


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

Reply via email to