This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes JSP and the fly likes Calling functions in a bean. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Calling functions in a bean." Watch "Calling functions in a bean." New topic

Calling functions in a bean.

Kerry Wilson
Ranch Hand

Joined: Oct 29, 2003
Posts: 254
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?
SCJP 1.4
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63873

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.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Calling functions in a bean.
It's not a secret anymore!