Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 15th, 2008, 12:27 AM
Registered User
 
Join Date: Jul 2008
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Retriving values from html:checkbox

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:html>
<body>
<html:form action="/log" method ="post">
<table width="500" border="0">
<tr>
<td>username :</td>
<td><html:text property="username" /></td>
</tr>
<tr>
<td>password : <br><br></td>
<td><html assword property="password" /><br><br></td>
</tr>
<tr>
<td><html:submit property="login" value="ADD"></td>
</tr>
</table>
<logic resent name="LIST_ELEMENTS" scope="request">

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

<html:checkbox property="ck_values" >

<bean:write name="myvalues" />

</html:checkbox>

</logic:iterate>
</logic resent>

</html:form>

</body>
</html:html>


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

java.util.ArrayList list = new java.util.ArrayList();
list.add(vmarks);
list.add(vid);
request.setAttribute("LIST_ELEMENTS",list);

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.

also i used <html:multibox> but am geting only one value.

how to get the values for those check boxes are checked.

Please help me out.


Thanks in advance

skumar
__________________
skumar
Reply With Quote
  #2 (permalink)  
Old July 16th, 2008, 04:37 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Try the "value" attribute of the "<html:checkbox/>" tag.

- Rakesh
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
checkbox checked by default by html:checkbox sachin.tathod Struts 3 December 4th, 2006 02:41 PM
checkbox values to dropdown december Classic ASP Professional 1 July 3rd, 2006 08:34 PM
Checkbox values HELP! vkwebcommander Classic ASP Databases 2 January 18th, 2005 08:29 AM
checkbox values zaman1111 Javascript 2 September 22nd, 2004 04:19 PM
Looping through form fields & retriving the values tdaustin Classic ASP Basics 8 June 10th, 2003 03:17 AM



All times are GMT -4. The time now is 04:31 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.