You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ed <st...@etmsoft.com> on 2009/05/23 00:22:10 UTC
Problem with LocaleAction
Hi, my links to change local dont work !!, here my code:
--------------- links:
<html:link action="/toSpanish">Español</html:link> ·
<html:link action="/toEnglish">English</html:link>
--------------- form-beans:
<form-bean name="English" type="org.apache.struts.action.DynaActionForm">
<form-property name="language" type="String" initial="en" />
<form-property name="country" type="String" initial="US" />
</form-bean>
<form-bean name="Spanish"
type="org.apache.struts.action.DynaActionForm">
<form-property name="language" type="String" initial="es" />
<form-property name="country" type="String" initial="ES" />
</form-bean>
--------------- actions:
<action path="/toEnglish" name="English"
type="org.apache.struts.actions.LocaleAction">
<forward name="success" path=".homeLayout" />
</action>
<action path="/toSpanish" name="Spanish"
type="org.apache.struts.actions.LocaleAction">
<forward name="success" path=".homeLayout" />
</action>
Also having the corresponding ApplicationResources_en_US.properties and
ApplicationResources_es_ES.properties configured.
I had the old method to change locale (implementing a custom Action
subclass and calling setLocale(request, locale); It worked fine.
What's wrong ?
Note: .homeLayout is a Tile definition.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Problem with LocaleAction
Posted by Paul Benedict <pb...@apache.org>.
Have you looked at the source of LocaleAction? I can't remember
whether it requires a form bean or uses straight request parameters.
Add scope="request" to your action mappings and see if it makes a
difference.
On Sat, May 23, 2009 at 1:00 PM, Ed <st...@etmsoft.com> wrote:
> I have realized that LocaleAction is not receiving the form bean, the error
> message "No bean specified" triggers.
>
> Why ??
>
> Ed escribió:
>>
>> Hi, my links to change local dont work !!, here my code:
>>
>> --------------- links:
>>
>> <html:link action="/toSpanish">Español</html:link> ·
>> <html:link action="/toEnglish">English</html:link>
>>
>> --------------- form-beans:
>>
>> <form-bean name="English" type="org.apache.struts.action.DynaActionForm">
>> <form-property name="language" type="String" initial="en" />
>> <form-property name="country" type="String" initial="US" />
>> </form-bean>
>>
>> <form-bean name="Spanish"
>> type="org.apache.struts.action.DynaActionForm">
>> <form-property name="language" type="String" initial="es" />
>> <form-property name="country" type="String" initial="ES" />
>> </form-bean>
>>
>> --------------- actions:
>>
>> <action path="/toEnglish" name="English"
>> type="org.apache.struts.actions.LocaleAction">
>> <forward name="success" path=".homeLayout" />
>> </action>
>>
>> <action path="/toSpanish" name="Spanish"
>> type="org.apache.struts.actions.LocaleAction">
>> <forward name="success" path=".homeLayout" />
>> </action>
>>
>> Also having the corresponding ApplicationResources_en_US.properties and
>> ApplicationResources_es_ES.properties configured.
>>
>> I had the old method to change locale (implementing a custom Action
>> subclass and calling setLocale(request, locale); It worked fine.
>>
>> What's wrong ?
>>
>> Note: .homeLayout is a Tile definition.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Problem with LocaleAction
Posted by Ed <st...@etmsoft.com>.
I have realized that LocaleAction is not receiving the form bean, the
error message "No bean specified" triggers.
Why ??
Ed escribió:
> Hi, my links to change local dont work !!, here my code:
>
> --------------- links:
>
> <html:link action="/toSpanish">Español</html:link> ·
> <html:link action="/toEnglish">English</html:link>
>
> --------------- form-beans:
>
> <form-bean name="English" type="org.apache.struts.action.DynaActionForm">
> <form-property name="language" type="String" initial="en" />
> <form-property name="country" type="String" initial="US" />
> </form-bean>
>
> <form-bean name="Spanish"
> type="org.apache.struts.action.DynaActionForm">
> <form-property name="language" type="String" initial="es" />
> <form-property name="country" type="String" initial="ES" />
> </form-bean>
>
> --------------- actions:
>
> <action path="/toEnglish" name="English"
> type="org.apache.struts.actions.LocaleAction">
> <forward name="success" path=".homeLayout" />
> </action>
>
> <action path="/toSpanish" name="Spanish"
> type="org.apache.struts.actions.LocaleAction">
> <forward name="success" path=".homeLayout" />
> </action>
>
> Also having the corresponding ApplicationResources_en_US.properties and
> ApplicationResources_es_ES.properties configured.
>
> I had the old method to change locale (implementing a custom Action
> subclass and calling setLocale(request, locale); It worked fine.
>
> What's wrong ?
>
> Note: .homeLayout is a Tile definition.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org