Another option might be to modify the path of the forward dynamically to
include the locale. A couple of ways of doing this might be:

1) Define your forwards with the path containing a slot for the locale, like
this:

    <forward name="success" path="menu_%1.jsp" />

At run time, you can fill in the blank after getting the code from the
Locale object. If you do this, remember not to modify the ActionForward
object you get back from findForward(), otherwise, it will only work the
first time.

2) Forward to an action that does the decision making. In this case, your
forwards might look something like this:

    <forward name="success" path="localeFixerUpper.do?successpage=menu.jsp"
/>

Then your LocaleFixerUpper (catchy name, huh? :-) ) action can do whatever
it needs to modify the successpage value before forwarding to it.

Neither of these is particularly clean, but they should work.

--
Martin Cooper


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 21, 2001 7:06 AM
Subject: RE: Dynamic forward to jsps


>
> Thanks for the reply Mike.  While the JSPs I have in mind will utilize the
> i18n features of struts ( through the MessageTag class & application
> resource files), I would also like the ability to use completely different
> JSPs altogether.  For example, think of a languages that read from right
to
> left.  In these instances it would be nice to have forms with text to the
> right of the the input fields.  So far I'm not sure how to best accomplish
> this with Struts.
>
> -Craig
>
>
>
>
>
>                     "Synovic,
>                     Michael"              To:
"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
>                     <michael.synovi       cc:     (bcc: Craig
Reichenbach/CAM/Lotus)
>                     [EMAIL PROTECTED]>            Subject:     RE: Dynamic forward
to jsps
>
>                     09/19/2001
>                     04:45 PM
>                     Please respond
>                     to struts-user
>
>
>
>
>
>
> Hey Craig,
>
> Don't know how to implement dynamic forwarding, but based on your example,
> you might want to investigate how to build a single JSP to handle multiple
> languages, rather than using different JSPs for different languages.
>
> Check out the I18N (internationalization) features of Struts.
>
> Mike
>
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 18, 2001 11:44 AM
> To: [EMAIL PROTECTED]
> Subject: Dynamic foward to jsps
>
>
>
> I have seen some discussion of dynamic forwarding in the archives as it
> pertains to passing parameters.  But I haven't seen anything yet that
> speaks to how one might have more than 1 "success" page.  For example,
> suppose I had menu.jsp and menu_es.jsp and I wanted to dynamically forward
> all requests from browsers set to accept Spanish to the Spanish jsp.
>
> Ignoring all  realistic implications & in order to get my question across,
> what comes to mind is a dynamic page attribute in struts-config, ie:
>
> <forward name="success"  page="${user.succes.page}">
>
> The value of success.page would then correspond to an entry in the various
> properties files, ie:
>
> AppResources.properties contains:
> user.success.page=menu.jsp
>
> AppResources_es.properties contains:
> user.successpage=menu_es.jsp
>
>
>
> The other thought that comes to mind is for the Action class to extract
the
> locality from the browser or session and then set a String variable
> representing the success  or failure page accordingly.   For example:
>
> String success = "success";
>
> if (locale == spanish)
>      success = "success_es";
>
> return mapping.findForward( success );
>
> Meanwhile the struts-config contains multiple 'success' forwards:
> <forward name="success"  page="menu.jsp">
> <forward name="success_es"    page="menu_es.jsp">
>
>
> This would be pretty weak and unscalable.
>
> I appreciate your thoughts, ideas, & solutions.
>
> Thanks,
> Craig
>
>
>
>


Reply via email to