Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Selecting which bean to use

 
langers
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am generating a generic/dynamic form for multiple database tables. Is there a way of selecting which bean or java code to use depending on the table?
Ie:
<jsp:useBean id='object' scope='page' class='<%= classname%>'
<jsp:setProperty name="object" property="*"/>
This code doesn't work. Is there another way of doing this either in the JSP or a bean.
Please help - its driving me mad!!!
Langers
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

"langers"
your name doesn't seem to agree with the javaranch guidelines.
please take a moment and re-register after reviewing the
guidelines at http://www.javaranch.com/name.jsp
thanks for your cooperation.
- satya
 
Sam Dalton
Author
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try writing a custom tag to do this. You can then put whatever bean you want back into the session/request.
You should be able to find an example of this in any elementary JSP book.
Also see the JavaOne presentations on my website.

If you want more info please post again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic