This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Adding attributes into scope automatically Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "Adding attributes into scope automatically" Watch "Adding attributes into scope automatically" New topic
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%
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Adding attributes into scope automatically
 
Similar Threads
Sustaining formbean attributes
Check box opens new window and checks a new box
Auto Session logoff
Capturing selected check boxes
checkbox values in session