Re: @StrutsParameter
Lukasz Lenart <[email protected]> Sun, 28 Sep 2025 12:18:59 +0200
| Newsgroups | gmane.comp.jakarta.struts.user |
|---|---|
| Message-ID | <CAMopvkN7QMD80h=5OtuVTP6hALd9GERAnEHORu4YxvFLmMGZ1Q@mail.gmail.com> |
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=C5=82= (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 set= ter methods can be scripted using a RegEx find and replace on all files mat= ching |*Action.java|. > > Find: |\n(\h*public void set[A-Z]\w*\((long|Long|int|Integer|String|doubl= e|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 expli= cit 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 a= nd =E2=80=9Eno access=E2=80=9C errors > > Best regards Ute > > > > Von meinem iPad gesendet > > > >> Am 25.09.2025 um 19:09 schrieb Prasanth<[email protected]>: > >> > >> =EF=BB=BFYeah, the code works. Even when it was a Boolean inside the V= ector @StrutsParameter had to be used on getXXX method. So I assume that ir= respective of the object type inside the Vector we have to annotate the get= XXX 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]> wr= ote: > >>>> > >>>> public Vector<String> getDistributionAmounts() > >>> =E2=80=A6 > >>> > >>>> public void setContacts(ArrayList<Long> contacts) > >>>> > >>>> As you can see above which method (getXXX/setXXX) has to be annotate= d 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] > > > >