You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Lee Joe <sc...@hotmail.com> on 2002/03/04 09:44:02 UTC
Switching Locale anywhere
I have a very common user requirement, that is, to allow switching the
locale on every page.
I can easily write an action which take the selected locale and the
invoking page as input and forward the response back to the invoking page.
However, if that invoking page is the result of some action, e.g. the
search result page of a search action, and that search result is stored in
the request scope, then after the language switch the page will display an
empty list (or even broken!).
I reckon it *may* be possible to invoke the language switch with the
incoming action as a parameter (that is not trivial right?), but that
incoming action may be a money transfer action that I don't want it to
repost.
So *tada* I figured out a *I thought it was smart* way to handle this. I
wrote a custom tag and put it on every page that can switch language. This
tag will save a copy of all the references to objects in the request scope
in a single buffer in the session just before the page get displayed. If
you switch language, I just restore all those objects back into request
scope. This works like a charm (well, for those enumeration I have to do
some tricks but that's ok...). I don't even need an action, this tag will
handle this. I just put a link resultPage.jsp?locale=fr_CA and then this
tag will do all the work or switching locale object in session and
restoring the request scope objects.
Ok then I saw how this would break down when the user opens 2 browsers for
the same session because I only have a single page buffer for the
references to the request scope objects. My questions are: 1) Any one has a
genuine solution to this requirement? Am I on the right path or am I
totally off? 2) Anyone see a dirty hack to my *not so smart* solution?
Thanks, Joe
_________________________________________________________________
在您的行動裝置上傳送接收 Hotmail 郵件,請移至 http://mobile.msn.com。
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Newbie Struts-Config.xml help
Posted by Boney Sze <se...@yahoo.com>.
I need to implement struts on my application.
My application functions like
page1.jsp --> servlet --> javabeans(database access)
--> page2.jsp
page2.jsp --> servlet --> javabeans --> page3.jsp
I have implemented struts using action mappings but it
only works when I use a URL link and has ****.do in
the URL.
But when I use <html:form> to process the request, it
does not work.
<form-beans>
<form-bean name="FormBean"
type="com.mybean"/>
</form-beans>
<action-mappings>
<action path="/dothis"
type="com.myServlet"
name="dothis"
scope="session"
validate="false">
<forward name="page2" path="/page2.jsp"/>
</action>
<action path="/forms"
type="com.myServlet"
name="FormBean"
scope="request"
input="/page2.jsp"
validate="false">
<forward name="page3" path="/page3.jsp"/>
</action>
<action path="/page2"
forward="/page2.jsp">
</action>
I hope you can help me.
Thanks
Boney Sze
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - sign up for Fantasy Baseball
http://sports.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>