You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Darren Hill <dh...@724.com> on 2002/10/18 21:02:43 UTC

access ApplicationResource from ActionForm

Hi All,

My ActionForm is populating a drop-down list ( LabelvalueBean's ) and I want
to say "- None -" for a none-selection .. and want it to be i18n.  So, can I
access the ApplicationResource to retrieve that 'None'.  If so, how?

Is this the best idea?

Darren.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: access ApplicationResource from ActionForm

Posted by Eddie Bush <ek...@swbell.net>.
You do not have access to any resources in ActionForm.  The form is just 
there to act as a conduit for data - something for it to pass through - 
like electricity passes through a wire.  In that case, the electricity 
would represent your data and the wire would be your form.  Notice that 
a wire does not change the state of the electricity.

The proper place to do this is in an Action class.  Action has a 
getResources method (a few different signatures I believe, actually). 
 This is where you would get that data.  You could then set some 
property of your form accordingly.

Darren Hill wrote:

>Hi All,
>
>My ActionForm is populating a drop-down list ( LabelvalueBean's ) and I want
>to say "- None -" for a none-selection .. and want it to be i18n.  So, can I
>access the ApplicationResource to retrieve that 'None'.  If so, how?
>
>Is this the best idea?
>
>Darren.
>

-- 
Eddie Bush




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: access ApplicationResource from ActionForm

Posted by Arion Yu <ar...@metrowalker.com>.
Hi all,

for ApplicationResource, check ActionForm.getServlet.getResources
for the locale, however, the variable is protected and you have no way 
to access it in this way.

One of the way to accomplish it is pre-create the form in Action (before 
going to JSP) and set the locale during the Action phase.


Would there be other way like adding a locale variable in ActionForm? Or 
a public getLocale in ActionServlet ?

Arion

P.S. my version is 1.0.2

Darren Hill wrote:

>Hi All,
>
>My ActionForm is populating a drop-down list ( LabelvalueBean's ) and I want
>to say "- None -" for a none-selection .. and want it to be i18n.  So, can I
>access the ApplicationResource to retrieve that 'None'.  If so, how?
>
>Is this the best idea?
>
>Darren.
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>