aspose file tools
The moose likes JSP and the fly likes CheckBox Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "CheckBox" Watch "CheckBox" New topic
Author

CheckBox

Sonu Sen
Greenhorn

Joined: Jun 03, 2009
Posts: 17
Hello,

I am generating a project in which I am creating checkbox dynamically means from database. Now my problem is when the form is load at the same time the perticular checkbox will be selected.

I hope I am clear, Please help me.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

your information is not enough
Sonu Sen
Greenhorn

Joined: Jun 03, 2009
Posts: 17
Thank you for giving attention on my question..let me explain in detail.

<ul class="checklist cl3">
<%
for (int i = 0; i < itemList.size(); i++) {
Item itm=(Item )itemList.get(i) ;

%>
<li class="alt" ><label for=""><input id="c1" name="<%=itm.getItemId() %>" type="checkbox" value=<%=itm.geItemId() %> onClick="return checkId()"/><%=itm.getName() %></label></li>
<%} %>
</ul>

This is my code from which i am creating a checkbox. Now my problem is. when the form is load at the same time I want to check a perticular checkbox.How its possible? please help.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

use Code tag.


you are using different name for each check box? ok . any way

get the value(checked box) on servlet set in scope and forward it to the jsp(view). and compare this with list(using contains()),if matched check .
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56224
    
  13

Please be sure to take the time to compose descriptive subjects for your posts; read this for more information.

A title such as "checkbox" is not helpful. What would happen if all posts had such a title?

Please go back and change your post to add a more meaningful subject by clicking the button on your post.

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CheckBox
 
Similar Threads
two values with one checkbox
checkbox in display:table
Retaining checked value in selectBooleanCheckbox on enabling
add(new Checkbox("B",null,false); wot no variable?
problem with unchecking checkbox