Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
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://aspose.com/file-tools
 
subject: Adding attributes into scope automatically
 
Similar Threads
Sustaining formbean attributes
Capturing selected check boxes
Check box opens new window and checks a new box
Auto Session logoff
checkbox values in session