• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamically created Check Boxes in a JSP

 
Chris Whited
Greenhorn
Posts: 24
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

I have a JSP where it displays a table from a database query and in that table I have checkboxes that are created for every row. I want to make those checkboxes dynamic (as in I want the value attribute of each checkbox to be dynamically created). In my table I have included the primary key field and its values, since they are unique I figure that is the value I should use to feed to my checkbox value attribute to make it unique for each row of data.

My question is, is there an EL expression to obtain this value from each row? And if so, what would it be?

My JSP is fed a reult object from the servlet which it then uses to make a table using JSTL.
Here is my JSP code:


I am trying to figure out what to put in for the value attribute (where all the question marks are about 3/4ths of the way down).

Any help would be greatly appreciated.

Thanks,
Chris Whited
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64724
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it what you want is a property of column, then it's just ${column.whatever}.
 
Chris Whited
Greenhorn
Posts: 24
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So in my case, my field name of my primary key is Ref_Num so would it be ${column.Ref_Num} or would it be the full database name, so ${column.Objectives.Ref_Num} where Objectives is the table name that has the Ref_Num primary key field?
 
Paul Clapham
Sheriff
Posts: 21002
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what database and table names have to do with it.

If your "column" attribute refers to an object with a getObjectives() method, then {column.objectives} is the way to get the result of calling that method. EL doesn't know anything about databases and tables, all it knows about is JavaBeans. It's up to you to design your attributes so that they are JavaBeans.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic