Advanced Java Question: Download Advanced Java PDF

If I define a method in JSP scriplet <%..%>, where will it go after translation into a servlet?

Tweet Share WhatsApp

Answer:

It will give compilation error. In order to define a method
in JSP, it should be defined in the JSP declarations <%!..%
>, and it can be called in the JSP expression.
On translation, the method will be added outside all
methods in the servlet class.

Download Advanced Java PDF Read All 24 Advanced Java Questions
Previous QuestionNext Question
Why use a datasource when you can directly specify a connection details? (in a J2EE application)?How will the struts know which action class to call when you submit a form?