Output will be displayed as:
<html>
<h2>Select Languages:</h2>
<form ACTION="jspCheckBox.jsp">
<input type="checkbox" name="id" value="Java"> Java<BR>
<input type="checkbox" name="id" value=".NET"> .NET<BR>
<input type="checkbox" name="id" value="PHP"> PHP<BR>
<input type="checkbox" name="id" value="C/C++"> C/C++<BR>
<input type="checkbox" name="id" value="PERL"> PERL <BR>
<input type="submit" value="Submit">
</form>
<%
String select[] = request.getParameterValues("id");
if (select != null && select.length != 0) {
out.println("You have selected: ");
for (int i = 0; i < select.length; i++) {
out.println(select[i]);
}
}
%>
</html>
After selecting the languages, when you submit the button, the message will be displayed with selected languages:
1 nhận xét:
Hi I am trying to present a check box dynaically from the database.
I want to use HashMaps in conjuction with the checkboxes any ideas ?
Thank you
Vamshi
Post a Comment