struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale Newfield <d...@newfield.org>
Subject Re: input fields with dynamic names
Date Tue, 04 May 2010 13:27:43 GMT
On 5/3/10 10:08 AM, Mitch Claborn wrote:
> Bump.  Any other ideas?

Yes.  ParameterAware allows you to handle parameters without the setters 
and getters you think are necessary.  Look there again.

-Dale

> Mitch Claborn wrote:
>> That works for setting parameter names, but not so well when the tags
>> in the JSP need to retrieve the value for display in the page,
>> particularly if there is a validation error. If there is a static
>> field named "fred" and the action has a "getFred()" method, then all
>> is good. But the field names in my case are dynamic, so I can't have a
>> getNNNNN for all of the dynamic fields.
>>
>> mitch
>>
>>
>> Greg Lindholm wrote:
>>> You are probably looking for ParameterAware
>>>
>>> http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/interceptor/ParameterAware.html
>>>
>>>
>>>
>>> On Wed, Apr 28, 2010 at 12:47 PM, Mitch Claborn <mitch@claborn.net>
>>> wrote:
>>>
>>>> I'm sure I've seen the answer to this somewhere, but darned if I can
>>>> find it
>>>> now when I need it!
>>>>
>>>> I have a page that allows edits of various options, the names of
>>>> which are
>>>> dynamically retrieved from the database. If I have the code in the
>>>> JSP as
>>>> below, the value displayed in the text field is always that from the
>>>> database. If there is a validation error, the user's input value is not
>>>> maintained as it would be if there were an explicit getter/setter
>>>> for each
>>>> option name. Is there a way to code the Action (or the JSP) so that the
>>>> value shown is the user's input value if there is an error?
>>>>
>>>> <s:iterator value="authorizedOptions" id="o">
>>>> <s:textfield size="10" name="${o.optionName}"
>>>> id="${o.optionName}" value="${o.valueInt}" />
>>>>
>>>> Mitch
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message