Re: @StrutsParameter

Prasanth <[email protected]> Wed, 8 Oct 2025 10:08:13 -0500
Newsgroups gmane.comp.jakarta.struts.user
Message-ID <[email protected]>
Below is a fragment of the jsp.

             <c:forEach items="${currentAccessLevels}" var="access" varStatus="loopStatus">
                 <tr class="${loopStatus.index % 2 == 0? 'row1':'row2' }">
                     <td><s:checkbox name="contacts" fieldValue="%{#attr.access.contactID}" value="%{contacts!=null && contacts.contains(#attr.access.contactID)}" 
submitUnchecked="true"/>${access.getContactName()}</td>
                 </tr>
             </c:forEach>

Thanks,
Prasanth

On 10/8/25 9:56 AM, Lukasz Lenart wrote:
> pon., 29 wrz 2025 o 16:44 Prasanth <[email protected]> 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<User> getUsers() {
>      return users;
> }
>
> <s:form action="index" method="POST">
>      <s:iterator value="users" status="status">
>          <s:hidden name="users[%{#status.index}].id"/>
>          <s:textfield name="users[%{#status.index}].name" label="User
> %{users[#status.index].id}" id="user_%{users[#status.index].id}"/>
>      </s:iterator>
>      <s:submit/>
> </s:form>
>
>
> Cheers
> Łukasz
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>