Re: Dealing with many JSP files with one Action
Subject: Re: Dealing with many JSP files with one Action From: Eric Rizzo [EMAIL PROTECTED] === Niall Pemberton wrote: I'm sure you can do something more intelligent than duplicating the whole set of jsps for each different language. If the problem is that you need different images for different languages then write your own tag to generate the path for the image based on the localle. I suggest using the pageKey or srcKey attribute of the html:img tag to specify an ApplicationResources key that holds the real image file name. Then your images can be i18ned just like your text. HTH, Eric -- Eric Rizzo Software Developer http://www.jibeinc.com --- A man talking sense to himself is no more insane than a man talking nonsense not to himself...or just as insane. -Rosencrantz and Guildenstern Are Dead -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Dealing with many JSP files with one Action
Thanks for your answer. Unfortunately, I am not able to modify the directory structure and all the way this is going to work. We don't want to just have the text in multiple languages : images also have to be different ; everything can be modified by marketing people (from different countries) who don't develop the Internet site, through a Content Management System tool. The example I chose was meant to be simple, but it is actually much more complicated than this. So, I repeat my question : is there a way for a single Action to serve multiple JSP files, by taking advantage of a relative path ? If the current JSP page I am viewing now is /FR/home/home.jsp, can I put inside this page an action (let's say a ForwardAction) that will show me the /FR/logon/logon.jsp ? And I want to use the same flow description to go frome the /EN/home/home.jsp file to the /EN/logon/logon.jsp ? The following does not work but it gives the idea : action path=/homeLogonRel type=org.apache.struts.actions.ForwardAction parameter=../logon/logon.jsp /action Thank you for your time. Olivier Schmeltzer Les donnees et renseignements contenus dans ce message sont personnels, confidentiels et secrets. Ce message est adresse a l'individu ou l'entite dont les coordonnees figurent ci-dessus. Si vous n'etes pas le bon destinataire, nous vous demandons de ne pas lire, copier, utiliser ou divulguer cette communication. Nous vous prions de notifier cette erreur a l'expediteur et d'effacer immediatement cette communication de votre systeme. The information contained in this message is privileged, confidential, and protected from disclosure. This message is intended for the individual or entity adressed herein. If you are not the intended recipient, please do not read, copy, use or disclose this communication to others ;also please notify the sender by replying to this message, and then delete it from your system. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Dealing with many JSP files with one Action
I'm not sure what you're asking. It is definitely possible for an Action to forward to as many different JSP files as you like. If you want to do dictate what page to forward to based on some contextual flag (like the user role), then you should just create local forwards in your struts-config to the different possible pages using a naming convention of some sort ( if it's based on locale, then en_US_logon, en_US_home, for instance), and then let your Action forward to the correct one for your user using mapping.findForward( forwardName). -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 11, 2002 12:02 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: Dealing with many JSP files with one Action Thanks for your answer. Unfortunately, I am not able to modify the directory structure and all the way this is going to work. We don't want to just have the text in multiple languages : images also have to be different ; everything can be modified by marketing people (from different countries) who don't develop the Internet site, through a Content Management System tool. The example I chose was meant to be simple, but it is actually much more complicated than this. So, I repeat my question : is there a way for a single Action to serve multiple JSP files, by taking advantage of a relative path ? If the current JSP page I am viewing now is /FR/home/home.jsp, can I put inside this page an action (let's say a ForwardAction) that will show me the /FR/logon/logon.jsp ? And I want to use the same flow description to go frome the /EN/home/home.jsp file to the /EN/logon/logon.jsp ? The following does not work but it gives the idea : action path=/homeLogonRel type=org.apache.struts.actions.ForwardAction parameter=../logon/logon.jsp /action Thank you for your time. Olivier Schmeltzer Les donnees et renseignements contenus dans ce message sont personnels, confidentiels et secrets. Ce message est adresse a l'individu ou l'entite dont les coordonnees figurent ci-dessus. Si vous n'etes pas le bon destinataire, nous vous demandons de ne pas lire, copier, utiliser ou divulguer cette communication. Nous vous prions de notifier cette erreur a l'expediteur et d'effacer immediatement cette communication de votre systeme. The information contained in this message is privileged, confidential, and protected from disclosure. This message is intended for the individual or entity adressed herein. If you are not the intended recipient, please do not read, copy, use or disclose this communication to others ;also please notify the sender by replying to this message, and then delete it from your system. -- 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]
RE: Dealing with many JSP files with one Action
I'm sure you can do something more intelligent than duplicating the whole set of jsps for each different language. If the problem is that you need different images for different languages then write your own tag to generate the path for the image based on the localle. IMHO I wouldn't resolve your issue this way, BUT... you could sub-class Action and do something like the following: public class LocalAction extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ActionForward forward = super.perform(mapping, form, request, response); String prefix = getLocale(request).getISO3Language(); if (prefix == null || prefix.length() ==0) return forward; else return new ActionForward(prefix + '/' + forward.getPath()); } } Niall -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 11 June 2002 12:54 To: [EMAIL PROTECTED] Subject: RE: Dealing with many JSP files with one Action -- Envoyée par Olivier Schmeltzer/QVI/GRAF/FR le 11/06/2002 13:43 --- Olivier Schmeltzer 11/06/2002 09:01 Pour : [EMAIL PROTECTED] cc : [EMAIL PROTECTED] (ccc : Olivier Schmeltzer/QVI/GRAF/FR) Objet : RE: Dealing with many JSP files with one Action Thanks for your answer. Unfortunately, I am not able to modify the directory structure and all the way this is going to work. We don't want to just have the text in multiple languages : images also have to be different ; everything can be modified by marketing people (from different countries) who don't develop the Internet site, through a Content Management System tool. The example I chose was meant to be simple, but it is actually much more complicated than this. So, I repeat my question : is there a way for a single Action to serve multiple JSP files, by taking advantage of a relative path ? If the current JSP page I am viewing now is /FR/home/home.jsp, can I put inside this page an action (let's say a ForwardAction) that will show me the /FR/logon/logon.jsp ? And I want to use the same flow description to go frome the /EN/home/home.jsp file to the /EN/logon/logon.jsp ? The following does not work but it gives the idea : action path=/homeLogonRel type=org.apache.struts.actions.ForwardAction parameter=../logon/logon.jsp /action Thank you for your time. Olivier Schmeltzer --- Les données et renseignements contenus dans ce message sont personnels, confidentiels et secrets. Ce message est adressé à l'individu ou l'entité dont les coordonnées figurent ci-dessus. Si vous n'êtes pas le bon destinataire, nous vous demandons de ne pas lire, copier, utiliser ou divulguer cette communication. Nous vous prions de notifier cette erreur à l'expéditeur et d'effacer immediatement cette communication de votre système. The information contained in this message is privileged, confidential, and protected from disclosure. This message is intended for the individual or entity adressed herein. If you are not the intended recipient, please do not read, copy, use or disclose this communication to others ;also please notify the sender by replying to this message, and then delete it from your system. -- To unsubscribe, e-mail: mailto:struts-user- [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]
RE: Dealing with many JSP files with one Action
Have you considered taking advantage of Struts i18n capabilities? By stripping out all display text (including button values) into the message resource files, you can better manage the content display by managing your i18n-ed files. You will realize the return on investment almost immediately if you were to.oh lets say .change the workflow of your site, or change the layout. You would only have to make the change in one place and not multiple files James Mitchell Software Engineer\Struts Evangelist Struts-Atlanta, the Open Minded Developer Network http://struts-atlanta.open-tools.org -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, June 10, 2002 12:21 PM To: [EMAIL PROTECTED] Subject: Dealing with many JSP files with one Action Hello everyone, I have a directory structure containing JSP files, in different languages, and I want to manage them with a single Action. For instance, let's take the Struts ForwardAction. How could this action serve different JSP files without having to hardcode it inside struts-config.xml ? If my directory structure is doc_root/FR/ and doc_root/US/, each directory containing my Home Page home.jsp, how can I write a single Action in my struts-config.xml to deal with both files ? I thought I could write something like http://www.xxx.com/FR/myForwardAction.do ; since the mapping I made is on the extension, the servlet is rightly called but no Action is selected. Why is there no match ? The attribute path of the action tag in struts-config.xml is said to be the application-relative path of the submitted request : in which way is it relative ? Thanks for any help, I think I am getting very much confused. Olivier Schmeltzer Les donnees et renseignements contenus dans ce message sont personnels, confidentiels et secrets. Ce message est adresse a l'individu ou l'entite dont les coordonnees figurent ci-dessus. Si vous n'etes pas le bon destinataire, nous vous demandons de ne pas lire, copier, utiliser ou divulguer cette communication. Nous vous prions de notifier cette erreur a l'expediteur et d'effacer immediatement cette communication de votre systeme. The information contained in this message is privileged, confidential, and protected from disclosure. This message is intended for the individual or entity adressed herein. If you are not the intended recipient, please do not read, copy, use or disclose this communication to others ;also please notify the sender by replying to this message, and then delete it from your system. -- 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]