• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Retriving values from html:checkbox in a jsp

Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai All,

Am facing a problem to retrive the values from the <html:chechbox>
Am using code like this:

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html:form action="/log" method ="post">
<table width="500" border="0">
<td>username :</td>
<td><html:text property="username" /></td>
<td>password : <br><br></td>
<td><html assword property="password" /><br><br></td>
<td><html:submit property="login" value="ADD"></td>
<logic resent name="LIST_ELEMENTS" scope="request">

<logic:iterate id="myvalues" name="LIST_ELEMENTS">

<html:checkbox property="ck_values" >

<bean:write name="myvalues" />


</logic resent>



In the action class am setting the values ArrayList and storing it in the request scope

java.util.ArrayList list = new java.util.ArrayList();

I need the values selected from the checkbox (vmarks,vid). when am using request.getString("ck_values") am getting ON then how can i retrive the slected values in my action class.

Please help me out.

Thanks in advance
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use html:multibox instead of html:checkbox. It still produces checkboxes, but is designed to be used with a group of related checkboxes all with the same property name. Below is the link to do documentation.

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic