Forums Register Login

Method declaration in a scriptlet??

+Pie Number of slices to send: Send
Hi Pals,

Can we define a method in a scriptlet??
If yes,that method goes inside the _jsp_Service method...then is that valid??
Could someone explain me....

Thanks in advance,
Javainn
+Pie Number of slices to send: Send
you could define a method using a jsp declaration

<%!
MyReturnType myMethod(MyParam1 param1, ...) {

... some code
}
%>

but even though this is scripting, this is not exactly a scriptlet but a jsp declaration. The method will be placed within the compiled jsp class, outside of your _jsp_service() method.

If you would put a method inside a scriptlet, it would be placed inside the _jsp_service() method upon jsp translation, so the Java compiler would complain about placing a method inside a method.
+Pie Number of slices to send: Send
Thanks once again Wei-ju Wu ,

Even i thought of the same thing that the method cannot be placed inside a method...But wanted to make sure...as I am new to this technology...Thankyou so much for your valuable answers.

javainn
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 4497 times.
Similar Threads
scriptlet
methods within scriptlets
jspService method
my jsp is showing too much in the browser
JSTL and declaratives
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 04:14:54.