Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Set the Checked attribute of Check Box

 
Steve Dyke
Ranch Hand
Posts: 1619
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic