Hi,
i don't remeber that for sure, but try s:url without action and
namespace, i think it might be what You are looking for.

Best greetings,
Pawel Wielgus.

2010/3/19, Ulf Liedén <ulf.lie...@gmail.com>:
> Hi Celinio,
>
> personally, I would build a method that gives back the URL of the page you
> are currently visiting, including all parameters. You put this method in a
> superclass of all your actions, so that its available everywhere. In the
> code you decide which locale parameter to set, according to your current
> locale.
>
> The method in the action class could look something like this:
>
>  public String getLocaleSwitchURL() { String url = getContextPath() +
> ServletActionContext.getActionMapping().getName() + ".action?" +
> "request_locale="; if (getLocale().toString().equals("en_EN")) { url +=
> "fr_FR"; flagURL = "fra.jpg"; } else { url += "en_EN"; flagURL = "eng.jpg";
> } url += "&"; url += ServletActionContext.getRequest().getQueryString();
> return url; } public String getFlagURL() { return getContextPath() +
> "images/" + this.flagURL; }
> All Strings should of course be configurable, and not hard coded like this.
> But just to give you an idea how it could work.  You output the link like
> this:
>
> <a href="<s:property value="localeSwitchURL" escape="false"/>">
>    <img src="<s:property value="flagURL" escape="false"/>" />
> </a>
>
> So if the user clicks the link, he will actually call the same page again,
> with the same parameters.
>
> Regards,
> Ulf
>
> On Fri, Mar 19, 2010 at 12:33 PM, Celinio Fernandes <cel...@yahoo.com>wrote:
>
>> hi,
>> I have a quick and basic question.
>> Regarding internationalization, whenever a user clicks on a link with a
>> flag, i want to change the locale (language)
>> of the web application.
>> That works well with the i18n interceptor.
>> However i always redirect the user to the home page (home.jsp) when i do
>> that because that is how i have setup the input result :
>>    <action name="changeLanguage" class="ServicesAction"
>>      method="changeLocale">
>>   <result name="input">/home/home.jsp</result>
>>    </action>
>>
>> My JSP looks like this :
>> <s:url id="url" action="changeLanguage.action">
>>      <s:param name="request_locale">fr</s:param>
>>     </s:url>
>>     <s:a href="%{url}" theme="xhtml"><img
>> src="<%=request.getContextPath()%>/images/flag_fr.png" /></s:a>
>>
>> So my question is :
>> how do you specify the current page in the input result name ?
>> so that the user stays on the current page when he changes languages.
>> Thanks for helping.
>>
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to