Category Archives: Java JSP Interview Questions

Can a JSP page instantiate a serialized bean? | Java JSP Questions

No problem! The use Bean action specifies the beanName attribute, which can be used for indicating a serialized bean. For example: A couple of important points to note. Although you would have to name your serialized file “filename.ser”, you only … Continue reading

Posted in Java JSP Interview Questions | Leave a comment

How do I include static files within a JSP page? | Java JSP Questions

Static resources should always be included using the JSP include directive. This way, the inclusion is performed just once during the translation phase. The following example shows the syntax: < % @ include file=”copyright.html” % > Do note that you … Continue reading

Posted in Java JSP Interview Questions | Leave a comment

Can you make use of a ServletOutputStream object from within a JSP page? | Java JSP Questions

No. You are supposed to make use of only a JSPWriter object (given to you in the form of the implicit object out) for replying to clients. A JSPWriter can be viewed as a buffered version of the stream object … Continue reading

Posted in Java JSP Interview Questions | Leave a comment

How does a servlet communicate with a JSP page? | Java JSP Questions

The following code snippet shows how a servlet instantiates a bean and initializes it with FORM data posted by a browser. The bean is then placed into the request, and the call is then forwarded to the JSP page, Bean1.jsp, … Continue reading

Posted in Java JSP Interview Questions | Leave a comment

Is there a way I can set the inactivity lease period on a per-session basis? | Java JSP Questions

Typically, a default inactivity lease period for all sessions is set within your JSPengine admin screen or associated properties file. However, if your JSP engine supports the Servlet 2.1 API, you can manage the inactivity lease period on a per-session … Continue reading

Posted in Java JSP Interview Questions | Leave a comment

How do you pass control from one JSP page to another? | Java JSP Questions

Use the following ways to pass control of a request from one servlet to another or one jsp to another. The RequestDispatcher object ‘s forward method to pass the control. The response.sendRedirect method

Posted in Java JSP Interview Questions | Leave a comment

Is there a way to reference the “this” variable within a JSP page? | Java JSP Questions

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.

Posted in Java JSP Interview Questions | Leave a comment

Can a JSP page process HTML FORM data? | Java JSP Questions

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 … Continue reading

Posted in Java JSP Interview Questions | Leave a comment

Can I stop JSP execution while in the midst of processing a request? | Java JSP Questions

Yes. Preemptive termination of request processing on an error condition is a good way to maximize the throughput of a high-volume JSP engine. The trick (assuming Java is your scripting language) is to use the return statement when you want … Continue reading

Posted in Java JSP Interview Questions | Leave a comment

How can I declare methods within my JSP page? | Java JSP Questions

You can declare methods for use within your JSP page as declarations. The methods can then be invoked within any other methods you declare, or within JSP scriptlets and expressions. Do note that you do not have direct access to … Continue reading

Posted in Java JSP Interview Questions | Leave a comment