Re: @StrutsParameter
Below is a fragment of the jsp.
submitUnchecked="true"/>${access.getContactName()}
Thanks,
Prasanth
On 10/8/25 9:56 AM, Lukasz Lenart wrote:
pon., 29 wrz 2025 o 16:44 Prasanth napisał(a):
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.
But how do you set values on the list, could you show an example JSP form?
I was testing this using a User entity with List/ArrayList and all
works as expected
@StrutsParameter(depth = 2)
public List getUsers() {
return users;
}
Cheers
Łukasz
-
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]
Re: @StrutsParameter
czw., 9 paź 2025 o 16:57 Prasanth napisał(a): > > The contacts variable is an ArrayList in the action class. All selected > contacts are correctly getting set in the action class contacts variable. > > Do you think depending on how the variable is defined in jsp we have to set > the parameter on get/set? No, this is a special case of how CheckboxInterceptor handles variables and you must annotate setter and getter in this case. In any other case with List/Maps just getter must be annotated Cheers Łukasz - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: @StrutsParameter
The contacts variable is an ArrayList in the action class. All selected
contacts are correctly getting set in the action class contacts variable.
Do you think depending on how the variable is defined in jsp we have to set the
parameter on get/set?
Thanks,
Prasanth
On 10/9/25 9:41 AM, Lukasz Lenart wrote:
śr., 8 paź 2025 o 17:08 Prasanth napisał(a):
Below is a fragment of the jsp.
${access.getContactName()}
This is probably due to how the CheckboxInterceptor works - it
collects all the values and sets them at once, that's why the setter
is used - you have one "contacts" value instead of multiple values eg.
"contacts[0]=...,contacts[1]=..."
Cheers
Łukasz
-
To unsubscribe, e-mail:[email protected]
For additional commands, e-mail:[email protected]
Re: @StrutsParameter
śr., 8 paź 2025 o 17:08 Prasanth napisał(a):
>
> Below is a fragment of the jsp.
>
> varStatus="loopStatus">
>
> fieldValue="%{#attr.access.contactID}" value="%{contacts!=null &&
> contacts.contains(#attr.access.contactID)}"
> submitUnchecked="true"/>${access.getContactName()}
>
>
This is probably due to how the CheckboxInterceptor works - it
collects all the values and sets them at once, that's why the setter
is used - you have one "contacts" value instead of multiple values eg.
"contacts[0]=...,contacts[1]=..."
Cheers
Łukasz
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: @StrutsParameter
pon., 29 wrz 2025 o 16:44 Prasanth napisał(a):
>
> 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.
But how do you set values on the list, could you show an example JSP form?
I was testing this using a User entity with List/ArrayList and all
works as expected
@StrutsParameter(depth = 2)
public List getUsers() {
return users;
}
Cheers
Łukasz
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: @StrutsParameter
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 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: 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 wrote: public Vector getDistributionAmounts() … public void setContacts(ArrayList 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]
Re: @StrutsParameter
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 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: > >> > >> 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 wrote: > > public Vector getDistributionAmounts() > >>> … > >>> > public void setContacts(ArrayList 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]
Re: @StrutsParameter
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: 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 wrote: public Vector getDistributionAmounts() … public void setContacts(ArrayList 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]
Re: @StrutsParameter
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 : > > 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 wrote: >>> >>> public Vector getDistributionAmounts() >> … >> >>> public void setContacts(ArrayList 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]
Re: @StrutsParameter
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 wrote: public Vector getDistributionAmounts() … public void setContacts(ArrayList 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]
Re: @StrutsParameter
On Thu, Sep 25, 2025 at 11:24 Prasanth wrote: > public Vector getDistributionAmounts() … > public void setContacts(ArrayList 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
Re: @StrutsParameter
In the below code the get method is annotated with @StrutsParameter. This works.
@StrutsParameter (depth = 1)
public Vector getDistributionAmounts() {
return this.distributionAmounts;
}
Here the set method is annotated with @StrutsParameter.
@StrutsParameter
public void setContacts(ArrayList contacts) {
this.contacts = contacts;
}
As you can see above which method (getXXX/setXXX) has to be annotated is
changing between Vector and ArrayList.
Thanks,
Prasanth
On 9/14/25 8:25 AM, Lukasz Lenart wrote:
czw., 21 sie 2025 o 19:18 Prasanth napisał(a):
Is the struts parameter tag supposed to be on setXXX method or getXXX method
for a check box list when the argument is Vector/ArrayList?. We have old code
that takes the data as a vector, for this we
have the parameter on the getXXX and it works well. For another action that has
ArrayList as parameter we had to move it from the getXXX to setXXX for it to
work. We had to annotate the getXXX methods
when the argument is a map, with depth of 1.
Is Vector handled differently than ArrayList when injecting parameter values?
Not sure if I understood your question, could write an example code and post it?
Cheers
Łukasz
-
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]
Re: @StrutsParameter
czw., 21 sie 2025 o 19:18 Prasanth napisał(a): > Is the struts parameter tag supposed to be on setXXX method or getXXX method > for a check box list when the argument is Vector/ArrayList?. We have old code > that takes the data as a vector, for this we > have the parameter on the getXXX and it works well. For another action that > has ArrayList as parameter we had to move it from the getXXX to setXXX for it > to work. We had to annotate the getXXX methods > when the argument is a map, with depth of 1. > > Is Vector handled differently than ArrayList when injecting parameter values? Not sure if I understood your question, could write an example code and post it? Cheers Łukasz - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

