You can use a servlet or a filter. Filter mappings can overlap servlet
mappings if you need them to. You can map all requests, or you can only map
the specific paths for which you will use forward(). You probably want a
filter if you are going to map all requests.

glad to help :-)

Charlie


> -----Original Message-----
> From: Stephen Riek [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 25, 2002 12:47 PM
> To: Tomcat Users List
> Subject: RE: help with multilingual JSP sites pls. using a Filter to
> rewri te the URL ?
> 
> 
> 
> Thanks Charlie.
> Genius. Another simple solution saves the day. 
> I presume you also mean that I should map all incoming requests to a
> servlet that then examines the PathInfo and issues the 
> requestDispatcher.
> Magnificent solution. Thank you indeed.
> Stephen.
>  "Cox, Charlie" <[EMAIL PROTECTED]> wrote:use 
> request.gePathInfo() to get the path. Then parse the string and use
> RequestDispatcher.forward("/products/Toys/index.jsp?myparam="+
> langString).
> The forward() will not be subject to further filter processing.
> 
> Charlie
> 
> > -----Original Message-----
> > From: Stephen Riek [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, November 25, 2002 11:27 AM
> > To: Tomcat Users List
> > Subject: Re: help with multilingual JSP sites pls. using a Filter to
> > rewrite the URL ?
> > 
> > 
> > 
> > Sorry, I'm not making myself clear here. My JSPs do exactly 
> > as you suggest 
> > so that I have one JSP serving up French and English pages, 
> > depending on 
> > the language that the user selected on my site.
> > Here is the problem explained very simply. I have a sitemap 
> > as follows:
> > /en
> > --> /Products
> > --> Toys/index.jsp
> > --> Decoration/index.jsp
> > /fr
> > --> /Products
> > --> /Toys/index.jsp
> > --> /Decoration/index.jsp
> > 
> > As you can see, this is braindead. If I wish the 
> > functionality of the English section 
> > of the site to be the same as that of the French part of the 
> > site, then any change
> > to a JSP in the 'en' part must be repeated within the 'fr' 
> > site. This is not 
> > scalable and is tedious. 
> > 
> > Instead, it would be much better if I had one site structure 
> > which served up the
> > whole site.
> > 
> > /Products
> > --> /Toys/index.jsp
> > --> /Decoration/index.jsp
> > 
> > Any changes to functionality only have to be made in one 
> > place and both the
> > french viewers and english viewers will experience the same 
> > user experience, 
> > just in different languages. (I use the properties files as 
> > you suggest to 
> > serve up different languages).
> > 
> > The problem however is "how does /Products/Toys/index.jsp" 
> > know whether
> > the user is viewing in English or French ? The easy way would 
> > be to have the
> > user select a language on entering the site and then store 
> > the language 
> > preference in a cookie which I check before serving up pages. 
> > However, 
> > users may access the site from a search engine or from direct 
> > URLs due to
> > promotions. I would like a request for 
> > /en/Products/Toys/index.jsp to be 
> > sent to /Products/Toys/index.jsp but with a 'lang' parameter 
> > set to 'en'. 
> > Likewise for the french part of the site. 
> > 
> > Surely somebody has had to encounter this sort of problem in 
> > dealing with
> > pan-European sites ?
> > 
> > Stephen.
> > 
> > 
> > 
> > Triptpal Singh Lamba wrote:One way you 
> > can do this is using property files.
> > 
> > Prop_ file name _ language code.properties
> > 
> > So for say abc.jsp , you have abc_en.properties and 
> abc_fr.properties.
> > 
> > At comple time the JSP calls a class you write at server 
> > which gives say String languageCode = 
> > ObjectName.getLaguageCode(param 1 ,param 2); %>
> > 
> > Then all JSP elements are picked from there.
> > Thanks
> > Tript Singh
> > 
> > 
> > 
> > 
> > 
> > ---------------------------------
> > With Yahoo! Mail you can get a bigger mailbox -- choose a 
> > size that fits your needs
> > 
> 
> --
> To unsubscribe, e-mail: 
> For additional commands, e-mail: 
> 
> 
> 
> 
> ---------------------------------
> With Yahoo! Mail you can get a bigger mailbox -- choose a 
> size that fits your needs
> 

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

Reply via email to