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

Calling functions in a bean.

 
Kerry Wilson
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this has probably been asked umpteen billion times, but:
Is there anyway to call a function from a jsp using xml tags without said call being in an expression or scriptlet tag?
-Speaking of which, do you access the bean within an expression type like this:
<jsp:usebean name="example" class="some.class.bean"/>
<jsp:expression> example.function(parameter); </jsp:expression>
Would this work?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a great way to check this (and any other JSP "how does this work" questions).
Code it up and hit the page. Then go find the .java file that the container created on the behalf of your JSP page. By looking at the container-generated code you can see exactly how your useBean directive (as well as anything else in a JSP) works.
Tomcat puts the generated Java files in a folder structure under $CATALINA_HOME/work. Resin puts them under WEB-INF/work in your web app hierarchy. I'm not sure where other containers store the files, but finding these and perusing them is one of the best JSP tools you don't have to buy.
bear
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic