You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by arunabh <ar...@iflexsolutions.com> on 2008/01/11 09:56:27 UTC
Want to get the value of label key which is there in the
ApplicationResources.properties in action class
hi ,
I have a requirement to get the value of label key , which is there in the
ApplicationResources.properties file .
Let me explain with an example :-
In my Jsp i get my label like
<fmt:message key="cust.firstName"/>
In my ApplicationResources.properties file i have mapped this key to some
value as :-
cust.firstName=First Name
Now my requirement is that , i want to anyhow get the
ApplicationResources.properties value of the Key in my action class .
That means in the above example First Name i want to get in the action class
.
Let me tell you I use Struts 2 in my application . I have tries with
<s:label key="cust.firstName">. This does create a label First Name in the
UI . But again i am not able to access the same in the action class (It's
neither available in request parameter nor in the value stack ). Means I am
not able to get the First Name label value in the action class .
Can some one provide me some guide lines how to achieve the target .
Thank you
Arunabh
--
View this message in context: http://www.nabble.com/Want-to-get-the-value-of-label-key-which-is-there-in-the-ApplicationResources.properties-in-action-class-tp14751999p14751999.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Want to get the value of label key which is there in the
ApplicationResources.properties in action class
Posted by ARCS <an...@pqa.com>.
May be a better or more appropriate way to do this but this works. You can
do this for any resource bundle you've created.
ResourceBundle bundle = ResourceBundle.getBundle("MyResources");
bundle.getString("myResourceBundleKey"));
-Andrew
arunabh wrote:
>
> hi ,
> I have a requirement to get the value of label key , which is there in
> the ApplicationResources.properties file .
>
> Let me explain with an example :-
>
> In my Jsp i get my label like
>
> <fmt:message key="cust.firstName"/>
>
> In my ApplicationResources.properties file i have mapped this key to
> some value as :-
> cust.firstName=First Name
>
> Now my requirement is that , i want to anyhow get the
> ApplicationResources.properties value of the Key in my action class .
> That means in the above example First Name i want to get in the action
> class .
>
> Let me tell you I use Struts 2 in my application . I have tries with
> <s:label key="cust.firstName">. This does create a label First Name in the
> UI . But again i am not able to access the same in the action class (It's
> neither available in request parameter nor in the value stack ). Means I
> am not able to get the First Name label value in the action class .
>
> Can some one provide me some guide lines how to achieve the target .
>
> Thank you
> Arunabh
>
>
>
--
View this message in context: http://www.nabble.com/Want-to-get-the-value-of-label-key-which-is-there-in-the-ApplicationResources.properties-in-action-class-tp14751999p14764226.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Want to get the value of label key which is there in the ApplicationResources.properties in action class
Posted by Dave Newton <ne...@yahoo.com>.
I'm not exactly sure what you're asking.
--- arunabh <ar...@iflexsolutions.com> wrote:
> In my Jsp i get my label like
>
> <fmt:message key="cust.firstName"/>
>
> Let me tell you I use Struts 2 in my application . I have tries with
> <s:label key="cust.firstName">. This does create a label First Name in the
> UI . But again i am not able to access the same in the action class (It's
> neither available in request parameter nor in the value stack ). Means I am
> not able to get the First Name label value in the action class .
>
> Can some one provide me some guide lines how to achieve the target .
getText("cust.firstName")
(If you extend ActionSupport or provide your own implementation of
TextProvider.)
d.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org