File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes html:checkbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:checkbox" Watch "html:checkbox" New topic
Author

html:checkbox

Shankar Narayana
Ranch Hand

Joined: Jan 08, 2003
Posts: 134
Hi,

In regular HTML checkbox, the value of the checkbox can practically be
anything but the struts html:checkbox limits us to just yes/true/on
values?

If I have a list of records that I get from the database and I want to
display it with a checkbox at the left, the value of the checkbox being
the id of the record, how do I do that? Should there be another hidden
field for the checkbox with the actual value? And how do I connect the
checkbox to its corresponding hidden field?

Thanks


"Failure is not when you fall down; its only when you fail to get up again."
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Should there be another hidden
field for the checkbox with the actual value? And how do I connect the
checkbox to its corresponding hidden field?


Why you use hidden field ???

I think, After render to html is like this

<input type="checkbox" name="test" value="1">

you can keep name, value any time.



SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Shankar Narayana
Ranch Hand

Joined: Jan 08, 2003
Posts: 134
I think, After render to html is like this

<input type="checkbox" name="test" value="1">

you can keep name, value any time.



Struts says that the value should be a string (true/yes/on),and if the value doesn't return any of these values , I hope it is an error and moreover on editing this page , how does the struts tag know which
checkbox to be checked, if the value is and integer constant.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30136
    
150

Shankar,
If you use html:multibox, you can set the value to anything.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Girish Varde
Greenhorn

Joined: Jul 09, 2004
Posts: 23
I have used checkBox and not multiBox. I have not faced any restriction on th value passed by the checkBox. I have used bean:write and passed value from database.
value='<bean:write name="leads" property="leadId"/>'
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html:checkbox
 
Similar Threads
DynaValidatorActionForm and checkboxes
jsp
Including Select All checkbox
How to set checkbox to checked by default
Iterate tag