dcsimg
Save selections of the client [shopping cart applica tion]
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   HELIGON_Sandra
Posted On:   Thursday, April 10, 2003 12:46 AM

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 in the table. I have defined the following form-bean: type="org.apache.struts.validator.DynaValidatorForm"> If the user select three DVDs and go to an other page, when it returns on the page the selection must be still visible. To do that I see 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 t   More>>

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 in the table.

I have defined the following form-bean:

type="org.apache.struts.validator.DynaValidatorForm">




If the user select three DVDs and go to an other page, when it returns on the page the selection must be still visible.
To do that I see 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.

   <<Less

Re: Save selections of the client [shopping cart applica tion]

Posted By:   Maria_Maccinato  
Posted On:   Thursday, April 10, 2003 04:09 AM

don't implement the reset-method() and everything is save.


to control when you want delete your selection - make your own reset() and call it in your action if requested!



a lot of success!
About | Sitemap | Contact