You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Heligon Sandra <sa...@thomson.net> on 2003/04/09 17:46:32 UTC

ActionForm and save actions of the client [shopping cart applica tion] HELP

	I have a JSP page which displays a list of objects DVDs for example
( a catalog of DVDs).
	With an aim of allowing to the operator the selection of one or more
dvds, I have a check-box
	column.
	I have defined the following form-bean:
	<form-bean name="myForm" dynamic="true"
type="org.apache.struts.validator.DynaValidatorForm">
	  <form-property name="dvds" type="java.util.ArrayList" />
	  <form-property name="selected" type="java.lang.String[]" />
  	</form-bean>

	If the user select three DVDs and go to an other page, when it
returns on the page of the dvds 
	must be still visible.
	To do that I saw two solutions:
	- 1.First solution
	save the form-bean in the session, but each time the page is
displayed the method reset is applied
	on the form, is this seems true? the selection is not saved.
	And I know that it is not recommended to save form-bean in the
HttpSession, isn't it ?
	-  2.Second solution
	save the form-bean in the request, and memorize user selections in
the HttpSession.
	if I have 20 dvds displayed and only 4 selected I thought that the
length of the "selected " property 
	of the form-bean will be 20.
	But when I do 
		String selectedDvd[] = null;
     	      	selectedDvd= BeanUtils.getArrayProperty(form, "selected");
	the length of selectedDvd is 4. I can't retrieve the index of the
dvds checked by the user.
	did somebody already implement this kind of application?
	Thanks a lot in advance.
	Sandra 


   


. 


----------------------------------------------------------------------------

As of February 12th, 2003 Thomson unifies its email addresses on a worldwide
basis. 
Please note my new email address: sandra.heligon@thomson.net 

http://www.thomson.net/