aspose file tools*
The moose likes JSP and the fly likes Calling bean methods from jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Calling bean methods from jsp page" Watch "Calling bean methods from jsp page" New topic
Author

Calling bean methods from jsp page

Mike Floyd
Greenhorn

Joined: Jan 27, 2005
Posts: 26
Hi to all, i would to call a method of a bean included in my jsp page.
The method take 2 arguments.
The difficult is that i must to use the JSTL tags.
How i can to do?
The method serves to me to control the data input element of a html page!
Please help me!
Thanks
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
You can do this by use
<jsp:setProperty /> or <jsp:getProperty/>

Look at the documentation
http://java.sun.com/products/jsp/tags/syntaxref.fm13.html


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Mike Floyd
Greenhorn

Joined: Jan 27, 2005
Posts: 26
ok thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61233
    
  66

Cannot be done with either the EL (JSTL) or <jsp:setProperty/>. These mechanisms are intended to access the properties of Java Beans (in other words, methods that follow the bean property pattern) and not to call arbitrary methods.

For that, you need to resort to scriptlets or scriplet expressions. Which should raise a red flag in your mind that says: "Why am I calling this method in my JSP? Am I perhaps doing processing that belongs elsewhere? Or should I be using a custom tag for this purpose?"
[ January 27, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mike Floyd
Greenhorn

Joined: Jan 27, 2005
Posts: 26
ok, i know that isn't functional merge the script and the jstl tags.
Can you gimme some indication to control the data from an html form?
i has a java method into a bean that works for this, but i prefere to abandone the old script to develop all my application with jstl.
thanks
bye
 
wood burning stoves
 
subject: Calling bean methods from jsp page