Java JSB Servlets Question and Answers
56. | What are all the different scope values for the <jsp:useBean> 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 |
|
57. | What types of comments are available in the JSP? |
---|---|
There are two types of comments allowed in the JSP. These are hidden and output comments. A hidden comment does not appear in the generated output in the html, while output comments appear in the generated output. Example of a hidden comment: <% This is a hidden comment -%> Example of an output comment: <!- This is an output comment -> |
|
58. | How will you handle the Runtime Exception in your jsp page? |
---|---|
The errorPage attribute of the page directive can be used to catch run time exceptions automatically and then forwarded to an error processing page. For example: <%@ page errorPage = "customerror.jsp" % > The above code forwards the request to "customerror.jsp" page if an uncaught exception is encountered during request processing. Within "customererror.jsp" , you must indicate that it is an error processing page, via the directive: <%@ page isErrorPage= "true" %>. |
|