| Author |
Adding attributes into scope automatically
|
Shashidhar Yarabati
Ranch Hand
Joined: Jun 17, 2007
Posts: 175
|
|
I have the following requirement. I have a list of check boxes(say 100 check boxes) in my JSP page. Each check box specifies different book name. The user clicks some check boxes and clicks the Add button. Then the list of book's (checked by the the user through check boxes) should get automatically added into my session attribute. So that I can use the session. Is it possible(in any way) to add bunch of attributes into session(or any scope) automatically?
|
Shashidhar<br /> SCJP 1.5<br /> SCWCD 5.0
|
 |
winay Kumar
Ranch Hand
Joined: Aug 13, 2007
Posts: 34
|
|
Hi, create an array if you want to add same kind of attributes, then add this array object to session. you can use ArrayList also.
|
Winay Kumar<br />SCJP 5.0
|
 |
Stas Fedorov
Greenhorn
Joined: May 13, 2008
Posts: 7
|
|
if you have same name for checkboxes, but different values (booknames), you can use In this case, if you have an array String[] name_of_checkboxes, you will get it filled automatically, after submitting.
|
 |
prabakaran perumal
Greenhorn
Joined: Jan 24, 2007
Posts: 27
|
|
|
You need to submit the data using html forms then only you can store to session objects.
|
 |
Arun kumar
Greenhorn
Joined: Apr 22, 2008
Posts: 10
|
|
|
Try using AJAX to call a servlet and send the checked values as parameters to the servlet and store it in the session . So that when you goto the next jsp or servlet you can directly access them
|
Regards,<br /> Arun Kumar<br />----------------------------------<br />SCJP 5.0 86%
|
 |
 |
|
|
subject: Adding attributes into scope automatically
|
|
|