-
Which of the following statements is true for reducing the number of writes to the client from the Servlet?
Skill/Topic: ServletsA) Use StringBuffer instead of String even for concatenating a group of Strings.B) Avoid writing every small string to clientC) Instead store all the strings into a StringBuffer and after sufficient data is available, send this data to Browser.D) All of the above.
-
An HTTP Servlet handles client requests through its service() method.
Skill/Topic: ServletsA) TrueB) FalseExplanation: The service method supports standard HTTP client requests by dispatching each request to a method designed to handle that request.
-
-
-
-
-
-
-
How do I mix JSP and SSI #include?
If you're just including raw HTML, use the #include directive as usual inside your .jsp file.<!--#include file="data.inc"-->But it's a little trickier if you want the server to evaluate any JSP code that's inside the included file. If your data.inc file contains jsp code you will have to use <%@ vinclude="data.inc" %> The <!--#include file="data.inc"--> is used for including non-JSP...
-
-
-
-
-
What are the differences between GET and POST service methods?
A GET request is a request to get a resource from the server. Choosing GET as the "method" will append all of the data to the URL and it will show up in the URL bar of your browser. The amount of information you can send back using a GET is restricted as URLs can only be 1024 characters. A POST request is a request to post (to send) form data to a resource on the server. A POST on the other hand will...
-
-
What are the uses of Servlets?
A servlet can handle multiple requests concurrently, and can synchronize requests. This allows servlets to support systems such as on-line conferencing. Servlets can forward requests to other servers and servlets. Thus servlets can be used to balance load among several servers that mirror the same content, and to partition a single logical service over several servers, according to task.
-
-
-
Can I stop JSP execution while in the midst of processing a request?
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 (asuming Java is your scripting language) is to use the return statement when you want to terminate further processing. For example, consider:<% if (request.getParameter("foo") != null) {// generate some html or update bean property} else {/* output...
-
Is there a way I can set the inactivity lease period on a per-session basis?
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 basis. This is done by invoking the HttpSession.setMaxInactiveInterval() method, right after the session has been created. For example:<%session.setMaxInactiveInterval(300);%>would...
JSP Interview Questions
Ans