This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Calling functions in a bean." Watch "Calling functions in a bean." New topic
Author

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?


http://www.goodercode.com
SCJP 1.4
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: Calling functions in a bean.
 
Similar Threads
Struts and how to insert a bean-value into a attribute
<jsp:expression>
Request-Time Attribute Expressions
XML syntax for jsp
XML syntax for JSP expressions