Click to See Complete Forum and Search --> : receiving checkbox values


amrigo
07-24-2007, 03:35 PM
hi

I have a list of a search resultset and i want to pass to another jsp page the checkbox values i have

<FORM name="f1" action="script.jsp" method="post" target="_blank">
<input type="Checkbox" name="chkPrint" value="7310">item 1
<input type="Checkbox" name="chkPrint" value="18410">item 2
<input type="Checkbox" name="chkPrint" value="20066">item 3
</FORM>

how it can be done ?

ianripping
07-25-2007, 08:47 AM
You need to have a submit button in your form:

<input type="submit" value="Submit">
Then, in your script.jsp, do something like this:

<html>
<head>
</head>
<body>
<%
String chkPrint = request.getParameter ("chkPrint");
%>
<p>Value of checkbox is <%=chkPrint%>
</body>
</html>

amrigo
07-25-2007, 02:26 PM
Thank´s Ian

And for arrays it wil work ?
if i receive more than one element

ianripping
07-26-2007, 02:41 AM
All the elements within the submitted form will be retrievable via the request object using the method I showed you before.

Hope it goes well!