aspose file tools*
The moose likes JSP and the fly likes can any body tell how to store check box value in session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "can any body tell how to store check box value in session" Watch "can any body tell how to store check box value in session" New topic
Author

can any body tell how to store check box value in session

vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
i have list of pagging 1 to 10.all the pagging have check box.if user check first 2 record and i am storing the value in session.and user click the second page the session value is overwrited can any body tell the solution?

my requirment is i have to store all the checked box value in session from first page and second page so on..the last page checked value only storing in session

my coding is

String id[]=request.getParameterValues("chkbox");
session.setAttribute("chkid",id);

thanks in advance
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
Hi Vijaykumar,
Is you click on next page link or button going to a servlet where you are getting the parameters and storing them in the session and the forwarding to the same jsp showing next set of records?
If yes the after getting the parameters you have to check if the attribute
chkbox is already bound to the session, if it is bound you have to add the newly checked elements to the originally stored ones, and the save in session scope with same name. Saving the checked elements as a List would be a beter idea then saving it as an array.
vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
i am including pagging.jsp in managenewsletter.jsp

<jsp:include page="pagging.jsp">
<jsp:param name="totalRecords" value="${recordcount}"/>
<jsp:param name="currentPage" value="${param.pageNo}"/>
<jsp:param name="recordsPerPage" value="10"/>
<jsp:param name="formname" value="frmnewsletter"/>
<jsp:param name="pageParam" value="pageNo"/>
<jsp:param name="linkSytle" value="button"/>
<jsp:param name="buttonClass" value="button2"/>
</jsp:include>


pagging.jsp
will create link 1 2 3

can anybody tell how to submit the managenewsletter.jsp at the time clicking the link?
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Can't you just use JavaScript to submit the page when the link is clicked?


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
i am calling fnsubmit() from pagging.jsp


managenewsletter.jsp

function fnsubmit()
{
url=" managenewsletter.jsp";
document.frmnewsletter.action=url;
document.frmnewsletter.method="post";
document.frmnewsletter.submit();
}

i am not able to get the check box value
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

Firstly please make sure you use code tags while posting your code.Unformatted code is difficult to read and results in less response for your post. Read this for more information. You can edit your current post to add code tags by clicking .

I am not getting hold of your problem, you need to tell more details.
On which page is the "chkbox" ? And do you get a null in the id[]?


SCJP, SCWCD.
|Asking Good Questions|
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can any body tell how to store check box value in session