• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dynamically created Check Boxes in a JSP

 
Greenhorn
Posts: 24
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic