Adam Hardy wrote:
On 10/20/2003 10:33 PM Ruth, Brice wrote:
Adam Hardy wrote:
On 10/20/2003 07:41 PM Ruth, Brice wrote:
Adam Hardy wrote:
On 10/20/2003 05:57 PM Ruth, Brice wrote:
Adam Hardy wrote:
If that's a real .jsp file then that has to be a real us
directory in your website. If that's the case, you can set the
locale via a tag in the JSP. Alternatively you could use a
filter. Have you thought of character encoding? If you have to
set the request character encoding, then you may as well take
care of the locale at the same time. A popular method is to use
a filter called SetCharacterEncodingFilter which is easy to find
the source code for on google or the tomcat website somewhere.
I was talking about virtual directories that are just mappings
which the action servlet looks at. If you aren't going to use a
filter, you could set the locale in the action instead, by
checking the mapping path for the locale code.
HTH
Adam
OK, I have to admit I'm a bit confused now :). I would like to be
able to use a virtual directory structure, where /us/, /de/,
/fr/, etc. just trigger something in Struts to set the locale
appropriately, so that when /index.jsp is accessed under a
particular virtual directory, its localized properly. Is this
possible? As for character encoding, I hadn't really given it
much thought and I'm not too familiar with filters, either ... is
that a Struts feature or a JSP/Tomcat feature?
Thanks!
You would access /us/index.do, where *.do is the servlet mapping
to struts in the web.xml, and /us/index is the struts action
mapping to index.jsp. The real path of the index.jsp is hidden
from public view by struts.
I doesn't have to be *.do - you can set up web.xml to map any
pattern to struts - for instance /us/index.schmindex would be
*.schmindex
Filters are not struts - they're in the J2EE servlet spec. You set
them up in web.xml as well. They're a lead pipe cinch. They act on
a mapping which the request must match for them to take effect,
but most of the time in this sort of situation, the mapping is
just /* for everything.
Tomcat processes the filters on the request before passing it to
struts.
Adam
OK, so I understand hiding the .jsp from the world with Struts,
that's cool by me - I can handle that. So in that context, the
virtual paths makes sense. As for the filters, would I set up a
filter for say /us, /de, /fr - and then have Tomcat add the correct
locale to the session before the request is passed on to Struts? Is
that the use of filters in this situation?
Brice
it seems to me that the best use of the filter would be just to have
one which sees all the traffic, and then it can extract the locale
code from the request URL, check that it's one you deal with :) and
then saves the info to the user's session.
Adam
Cool, that's actually the route I'm taking now - just to test it out.
Thanks a ton! :) I think between the various approaches, I have a
plan now!
Brice
Great. Hope it works out.
Hehe, you'll be the first to know if it doesn't :)
--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]