struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig_Reichenb...@lotus.com
Subject RE: Dynamic forward to jsps
Date Fri, 21 Sep 2001 14:06:22 GMT

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:     "'struts-user@jakarta.apache.org'" <struts-user@jakarta.apache.org>
                   
                    <michael.synovi       cc:     (bcc: Craig Reichenbach/CAM/Lotus)  
                                                  
                    c@sap.com>            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: Craig_Reichenbach@lotus.com [mailto:Craig_Reichenbach@lotus.com]
Sent: Tuesday, September 18, 2001 11:44 AM
To: struts-user@jakarta.apache.org
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





Mime
View raw message