This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Servlets and the fly likes jsp:usebean - deciding which bean at run time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "jsp:usebean - deciding which bean at run time" Watch "jsp:usebean - deciding which bean at run time" New topic
Author

jsp:usebean - deciding which bean at run time

Steven Briggs
Greenhorn

Joined: Jul 20, 2001
Posts: 6
I want to be able to use the same jsp page to load different JavaBeans from session scope (using jsp:usebean), depending on the value of a parameter in the session.
I can't put the jsb:usebean tag inside an if statement - any ideas?
Steven
Sunetra Saha
Ranch Hand

Joined: Feb 25, 2001
Posts: 77
Why not ? Try this
<% if (condition) { %>
<jsp:useBean .......>
<% } else (condition) { %>
<jsp:useBean .......>
<% } %>
Steven Briggs
Greenhorn

Joined: Jul 20, 2001
Posts: 6
Aha, I knew it would be something obvious! Thanks for your patience with me, a simple, tired and thoughtless fool. I'd not closed off the %> of the if statement before beginning the jsp:usebean tag.
Thanks
Steven
 
GeeCON Prague 2014
 
subject: jsp:usebean - deciding which bean at run time