Thomas Hamacher wrote:
Laurie,
thank you so for. This makes sense to me.
But the problem is, that I don´t really have a source-url, as it is used in
the examples. I´m using tiles and therefor I have to work with definitions. I
guess, I cannot add any definition as a source, can I?
Sure you can, just make 'source' a tile attribute and set it where you
reference the tile.
Actually I always want to return to the same page, together with any used
params and all information of the form-bean, but with a different Locale.
That´s it. But this doesn´t seems to be that trivial, altough I thought this
would be a standard-problem...
As long as you forward (rather than redirect) to the destination page,
the request data (what the form bean was populated from) will be
retained. If you always want to go to the same page, you can just do
'return mapping.findForward("foward name");' to get the result you want.
L.
Thomas
On Wednesday 16 November 2005 22:56, Laurie Harper wrote:
You don't need to save the parameter, you can just append it to the URL
you forward to at the end of your SwitchLanguage action, assuming you
know it should be there. RedirectAction in Struts 1.2.7 and up gives you
a relatively easy way to add parameters to a forward mapping before you
return it.
There's no way to save the parameter on the action forward, since such a
feature wouldn't be very useful -- consider what would happen if two
different users hit the switchLanguage action at the same time.
If you need to solve the more general problem, where you don't know in
your SwitchLanguage action where to return, it gets rather harder. See
my post earlier today on this topic for some suggestions for that problem.
L.
Thomas Hamacher wrote:
Okay - here are some more details:
Let's say I have the following URL: http://somehost/showEntry?entryID=343
I have multilanguage support in my application, so let´s assume, that I
click on the language-button and therefor call the page
/switchLanguage.do, which changes my Locale. The switchLanguage uses the
last ActionForward to link back to the refering page (showEntry). But the
problem is, that it doesn't have the param "entryID" anymore. So the page
shows an empty page. As I don't want to add this parameter in my
session-, but in the request scope I have to remember this param somehow.
So I thought if there might be a way to save this to the ActionForward,
because there is no request.setParameter()-Method anywhere. And I have
been told that the reques.getHeader("referer")-solution is pretty unsafe,
because of proxies and firewalls. So I wonder what would be the best way,
as I think refering back to one page and mulit-language-support should be
one of the standard-issues on modern webapplication.
I hope that helps a little..
Thanks
Thomas
On Thursday 10 November 2005 22:31, Laurie Harper wrote:
Thomas Hamacher wrote:
But anyways: does anybody know, if the parameters, given through paramId
are saved in an ActionForward? This would help me a lot, because I have
to remember the parameters - if any are used - together with my
ActionForward for later references. Right know I'm trying a workaround
with my own RequestProcessor, which tries to cut out the parameters and
save it somewhere and add it later to the ActionForward, but that
doesn't work that well.
I'm not quite sure what you're trying to do. The parameters you specify
through paramId are request parameters to include in the URL. They're
available in your action through your form bean or from
request.getParameter().
An ActionForward is what your action returns to tell Struts where to
forward control to after the request has been processed. So the
parameters you setup when you construct the URL don't have anything to
do it.
Perhaps you can explain what you are trying to achieve by saving the
parameters?
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]