Jose Carlos Garcia
Jose Carlos Garcia

Reputation: 11

Struts 2 Array List in Value Stack

I´m working with struts 2 i have arraylist of object, i use a <S:iterator> for display the informatio in the jsp and it´s work ok, but i modified one attribute of the object and send to the action and the attribute have been modified have value but all other elements are null's, it is the code of the jsp:

 <s:iterator id="lisbusquedadetalle"  status="itstatus">
 <s:property value="#itstatus.count"/>)<br/>
 <s:property value="%{lisbusquedadetalle[#itstatus.index].articulo.descripcion1}"/><br/>
 <s:textfield key="lisbusquedadetalle[%{#itstatus.index}].cantidadordena" size="7px"/>>   </s:iterator>

in the action "cantidadordena" have the value that have been set in the jsp but "articulo.descripcion1" is null in action but in the JSP this display info.

Thanks, regards.

Upvotes: 1

Views: 1401

Answers (1)

jhouse
jhouse

Reputation: 2692

If you want the value of descripcion1 to post back to the action, then you must place it in the form as a field so that the form posts this. If you don't want the user to edit it, you could put it in a disabled text field, or in a hidden field (as well as on the screen as you are currently doing.

Struts2 (or most any other framework, for that matter) does not save the contents of your value stack between requests. Each request gets its own new value stack, based on the posted parameters and whatever the action exposes.

Upvotes: 2

Related Questions