Masaoud wrote:
>
> Hi,
>
> I wish to define a function in my JSP, which executes at the server.
> I tried using
>
> <SCRIPT RUNAT="server">
>
> public String doSomething( String input ) {
> String retVal = new String();
> retVal = input + " hello";
> return retVal;
> }
>
> </SCRIPT>
>
> The above is similar to an example I saw in a book related to JSP.
> When I use the function in my JSP code, it gives me an error that
> it cannot find the specified method.
>
> How do I do the above ?
This looks like an example using the old JSP 0.91/0.92 syntax. Make sure you
use the syntax that matches the version of your JSP container. If you're using
an old reference implementation I suggest you upgrade to JSWDK 1.0.1 (JSP 1.0)
or try the "still-under-development" JSP 1.1 reference implementation from the
Jakarta project, see http://java.sun.com/products/jsp
As a side-note, I suggest you encapsulate code that you want to use in your
JSP pages in a bean or a custom action (JSP 1.1) instead of declaring them
directly in the JSP page as above. Keeping most of the code out of the actual
JSP pages makes it both much easier to maintain the JSP application and share
logic throughout the application.
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html