What about using JavaScript? Try this: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Changing location</title> </head> <body> <script language="JavaScript"> 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; } } }
</script> <input type="button" value="RUS" onclick="changeLanguage('ru')"/> <input type="button" value="ENG" onclick="changeLanguage('en')"/> </body> </html> It will work if you don't need the addition page (such as when dealing with login). 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 [mailto:[EMAIL PROTECTED] > 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, <html:form> 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. > http://struts.apache.org/1.x/struts-taglib/tlddoc/html/form.html > 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. > > HTH > Antonio > > > --------------------------------------------------------------------- > 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]