Can a JSP page process HTML FORM data
Yes. However, unlike Servlet, you are not required to implement HTTP-protocol specific methods like doGet() or doPost() within your JSP page. You can obtain the data for the FORM input elements via the request implicit object within a scriptlet or expression as.
Is there a way to reference the “this” variable within a JSP page? Yes, there is. Under JSP 1.0, the page implicit object is equivalent to “this”, and returns a reference to the Servlet generated by the JSP page.
How do I include static files within a JSP page
Static resources should always be included using the JSP include directive. This way, the inclusion is performed just once during the translation phase. Do note that you should always supply a relative URL for the file attribute. Although you can also include static resources using the action, this is not advisable as the inclusion is then performed for each and every request.
What are JSP Custom tags
JSP Custom tags are user defined JSP language elements. JSP custom tags are user defined tags that can encapsulate common functionality. For example you can write your own tag to access the database and performing database operations. You can also write custom tags to encapsulate both simple and complex behaviors in an easy to use syntax. The use of custom tags greatly enhances the functionality and simplifies the readability of JSP pages.
What are all the different scope values for the tag
< jsp : useBean > tag is used to use any java object in the jsp page. Here are the scope values for < jsp : useBean > tag:
- page
- request
- session and
- application
How is JSP include directive different from JSP include action.
When a JSP include directive is used, the included file’s code is added into the added JSP page at page translation time, this happens before the JSP page is translated into a servlet. While if any page is included using action tag, the page’s output is returned back to the added page. This happens at runtime.
What is the page directive is used to prevent a JSP page from automatically creating a session
<%@ page session=”false”>
How do you pass control from one JSP page to another
Use the following ways to pass control of a request from one servlet to another or one jsp to another.
- First is RequestDispatcher object‘s forward method to pass the control.
- Second is response.sendRedirect method.
Is JSP technology extensible
YES. JSP technology is extensible through the development of custom actions, or tags,
which are encapsulated in tag libraries.
What are the two kinds of comments in JSP and what’s the difference between them
<%– JSP Comment –%>
<!– HTML Comment –>
What is JSP scripting element
A JSP declaration, scriptlet, or expression whose syntax is defined by the JSP specification and whose content is written according to the scripting language used in the JSP page. The JSP specification describes the syntax and semantics for the case where the language page attribute is “java”.