JSP
What is the jspDestroy() method?
Dec 1st
The jspDestroy() method of the javax.servlet.jsp.JspPage interface is invoked by the container when a JSP page is about to be destroyed. This method is similar to the destroy() method of servlets. It can be overridden by a page author to perform any cleanup operation such as closing a database connection.
How can I override the jspInit() and jspDestroy() methods within a JSP page?
Nov 27th
The jspInit() and jspDestroy() methods are each executed just once during the lifecycle of a JSP page and are typically declared as JSP declarations:
<%!public void jspInit() {. . .}%><%!public void jspDestroy() {. . .}%>
What is the jsp:plugin action ?
Nov 26th
This action lets you insert the browser-specific OBJECT or EMBED element needed to specify that the browser run an applet using the Java plugin.
What are scripting elements?
Nov 26th
JSP scripting elements let you insert Java code into the servlet that will be generated from the current JSP page. There are three forms: 1. Expressions of the form that are evaluated and inserted into the output, 2. Scriptlets of the form that are inserted into the servlet’s service method, 3. Declarations of the form that are inserted into the body of the servlet class, outside of any existing methods.
What is a scriptlet?
Nov 26th
A scriptlet contains Java code that is executed every time a JSP is invoked. When a JSP is translated to a servlet, the scriptlet code goes into the service() method. Hence, methods and variables written in scriptlets are local to the service() method. A scriptlet is written between the tags and is executed by the container at request processing time.
What are JSP declarations?
Nov 26th
As the name implies, JSP declarations are used to declare class variables and methods in a JSP page. They are initialized when the class is initialized. Anything defined in a declaration is available for the whole JSP page. A declaration block is enclosed between the tags. A declaration is not included in the service() method when a JSP is translated to a servlet.
What is a JSP expression?
Nov 26th
A JSP expression is used to write an output without using the out.print statement. It can be said as a shorthand representation for scriptlets. An expression is written between the tags. It is not required to end the expression with a semicolon, as it implicitly adds a semicolon to all the expressions within the expression tags.
How is scripting disabled?
Nov 26th
Scripting is disabled by setting the scripting-invalid element of the deployment descriptor to true. It is a subelement of jsp-property-group. Its valid values are true and false. The syntax for disabling scripting is as follows:
*.jsp true
What is the standard action?
Nov 26th
• The standard action forwards a response from a servlet or a JSP page to another page. • The execution of the current page is stopped and control is transferred to the forwarded page. • The syntax of the standard action is :
Here, targetPage can be a JSP page, an HTML page, or a servlet within the same context. • If anything is written to the output stream that is not buffered before , an IllegalStateException will be thrown. Note : Whenever we intend to use or in a page, buffering should be enabled. By default buffer is enabled.
More >