File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Set the Checked attribute of Check Box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Set the Checked attribute of Check Box" Watch "Set the Checked attribute of Check Box" New topic
Author

Set the Checked attribute of Check Box

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
If I am using JSTL to populate a table and one of my columns is a check box and the value of the item for the cell is 1 or 0, how can I set the checked attribute based on this value?

Seems I need a condition within the input tag like

if value = 1 checked
[ July 18, 2008: Message edited by: Steve Dyke ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60781
    
  65

Assuming JSP 2.0 you can easily include or exclude any template text (such as HTML pieces-parts) using the EL's ternary operator.

For example:


Your turn.
[ July 18, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: Set the Checked attribute of Check Box
 
Similar Threads
checkbox in jsp
Does this work for checkbox ?
Enable combo box when check box is checked
validating textfield with +ve/-ve values using 2 radiobuttons
jsp page checkbox issue