struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leo mj <>
Subject RE: Forward to the same page
Date Fri, 08 Sep 2006 09:03:10 GMT
hi antonio,

 It can be done by using ActionForwards.Also go tru internatinalization in struts
for displaying langauage :

in the action class use
  ActionForward forward=new ActionForward();

if(chk whther the language  combo box has been selected ){



add internationalization code using 
get language to be selected using request.getAttribute("fieldName");

in ur jsp...



Artem Zhmurov <> wrote: What about using JavaScript? Try this:

Changing location 

function changeLanguage(lang){
 var location = window.location.href;
 if(location.indexOf("?") == -1){
  location += "?lang=";
  location += lang;
  window.location = location;
 } else {
  var pos = location.indexOf("lang=");
  if(pos != -1){
   var new_location = location.substring(0, pos + 5);
   new_location += lang;
   window.location = new_location;
  } else {
   location += "&lang=";
   location += lang;
   window.location = location;


It will work if you don't need the addition page (such as when dealing with

Also you have to be sure, that your lang=.. parameter is in the end of
parameters line (that is true until you're not trying to add lang=..
somewhere outside). And there will be problem if your application dealing
with parameters named, for example, 'XXXlang'. All imperfections mentioned
can be removed by some little changes in script.

> -----Original Message-----
> From: Antonio Petrelli []
> Sent: Friday, August 25, 2006 12:09 PM
> To: Struts Users Mailing List
> Subject: Re: Forward to the same page
> Thomas Hamacher ha scritto:
> > How do I forward to the same page I was coming from? The typical example
> for
> > this is the "change-language-problem". Someone is on one page and simply
> > wants to change the language and expects to see the same page in a
> different
> > language.
> >
> Just an idea,  tag has the "action" attribute that is no more
> required. If it is not specified the last servlet path (i.e. "post
> back") will be taken.
> You could grab the code that controls the value of the "action"
> attribute to determine the path you're coming from. Then you "change the
> language" and then redirect (I think it's better than forwarding) to the
> previous servlet path.
> Antonio
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message