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 custom methods in jsp 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 "custom methods in jsp" Watch "custom methods in jsp" New topic

custom methods in jsp

Alfonso Harding
Ranch Hand

Joined: Feb 09, 2002
Posts: 35
can someone tell me whats wrong with this code??
Garann Means
Ranch Hand

Joined: Jan 28, 2002
Posts: 214
I think you need to send "out" to the callMe method, or it won't know what you want it to do. So it would be more like this:
Originally posted by Alfonso Harding:

Note that I'm not positive "out" is a PrintWriter, so I can't guarantee you this works as is.
John Wetherbie

Joined: Apr 05, 2000
Posts: 1441
Try this...

A couple notes. You don't need to import java.lang, it is imported automatically just as in a regular Java class. For testing things out having Java code in your JSP is OK but you should try to avoid code in your JSP as much as possible. If you want to avoid using a bean, and there are reasons to do this, you may want to use a custom tag to do what you want to do.
It also helps to include the error messages you are seeing along with your code to help the troubleshooting along.
Hope this helps and good luck!
[ October 24, 2002: Message edited by: John Wetherbie ]

The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
I agree. Here's the link:
subject: custom methods in jsp
Similar Threads
Page is still executed even after response.sendRedirect()
Pop up new HTML page in JSP
why jsp cannot use this class, which is no problem when compile singlely.
Cannot retrieve init parameter through JSP file
Exception while using attribute in tag file