|
Campbell,
You need to declare your method in a declaration block; Note the '!' <%! public int xsqr( int x ) { return ( x * x ); } %> Now use the declared method. <%= xsqr(2) %> You should try to avoid doing this. It's much better to keep java code
out of the JSP file.
Campbell wrote: Is there a way to add methods, written in jsp, to a jsp file, other than by calling beans? ex: <% here is my jsp... int x = 2; out.println( xsqr( x ) ); %> <% // and here is my jsp method... public int xsqr( int x ) { return ( x * x ); } %> // which of course doesn't work... :^? |
- jsp methods... Campbell
- Re: jsp methods... Peter Johnson
- Re: jsp methods... Robert McCarter
