Re: @StrutsParameter

Prasanth <[email protected]> Mon, 29 Sep 2025 09:23:15 -0500
Newsgroups gmane.comp.jakarta.struts.user
Message-ID <[email protected]>
--------------HBvKzfzZKeHVOr5gyNCskp0P
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

That was my thinking until ArrayList was not populated when I had the StrutsParameter on getXXX. For ArrayList the annotation has to be on setXXX.

On 9/28/25 5:18 AM, Lukasz Lenart wrote:
> This makes sense, because in case of containers like
> Maps/Lists/Vectors you first must get the container and then update
> it, eg.:
>
> someAction.getMap().put(...)
>
> This is how OGNL works under the hood. Maybe it's worth mentioning
> this in the Migration Guide
>
> czw., 25 wrz 2025 o 21:58 Prasanth<[email protected]> napisał(a):
>> See below, from migration guide. Based on the below everything other than classes you have defined should have @StrutsParameter on setXXX.  The only exceptions I found so far are Maps and Vectors.
>>
>> |----------------------------------------|
>> When upgrading to Struts 7.0, adding the necessary annotations to all setter methods can be scripted using a RegEx find and replace on all files matching |*Action.java|.
>>
>> Find: |\n(\h*public void set[A-Z]\w*\((long|Long|int|Integer|String|double|Double|Object|Number|Character|char|Float|float|List|Collection|Set|Date|LocalDateTime|Calendar|File))|
>>
>> Replace: |\n    @StrutsParameter\n$1
>> ----------------------------------------|
>>
>> Thanks,
>> Prasanth
>>
>> On 9/25/25 2:24 PM, Ute Kaiser wrote:
>>> I would also appreciate some more information on this.
>>> I use annotated public declarations on Strings, int, long without explicit getter/setter, but for objects I spread around with annotations on both getter and setter since I have not found out yet which is the right one to annotate for different scenarios.
>>> For displaying, it seems ok to use public declarations on everything,
>>> but when save with validations is needed, I struggle with lost values and „no access“ errors
>>> Best regards Ute
>>>
>>> Von meinem iPad gesendet
>>>
>>>> Am 25.09.2025 um 19:09 schrieb Prasanth<[email protected]>:
>>>>
>>>> Yeah, the code works. Even when it was a Boolean inside the Vector @StrutsParameter had to be used on getXXX method. So I assume that irrespective of the object type inside the Vector we have to annotate the getXXX method for Vectors.
>>>>
>>>> Thanks,
>>>> Prasanth
>>>>
>>>>> On 9/25/25 11:59 AM, Dave Newton wrote:
>>>>>> On Thu, Sep 25, 2025 at 11:24 Prasanth<[email protected]> wrote:
>>>>>>
>>>>>> public Vector<String> getDistributionAmounts()
>>>>> …
>>>>>
>>>>>> public void setContacts(ArrayList<Long> contacts)
>>>>>>
>>>>>> As you can see above which method (getXXX/setXXX) has to be annotated is
>>>>>> changing between Vector and ArrayList.
>>>>> It also changes the generic type; did it work with strings?
>>>>>
>>>>> d
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe,e-mail:[email protected]
>>>> For additional commands,e-mail:[email protected]
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe,e-mail:[email protected]
>>> For additional commands,e-mail:[email protected]
>>>
>>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:[email protected]
> For additional commands, e-mail:[email protected]
>
>

--------------HBvKzfzZKeHVOr5gyNCskp0P--