Showing posts with label servlets. Show all posts
Showing posts with label servlets. Show all posts

April 14, 2017

J2EE Technologies Details explanation with examples

Normal 0 false false false EN-US X-NONE X-NONE ...
Read more ...

February 19, 2013

Which of the following snippets of the deployment descriptor can be used to return the value "mySecret" when the following API is called: getServletConfig ().getInitParameter ("sharedSecret")?

The getServletConfig () API returns a ServletConfig class. When the Container initializes a servlet, the container creates a unique ServletConfig for the servlet. In fact, each servlet in a web app has its own ServletConfig. The container retrieves the servlet initialization parameters from the Deployment Descriptor, and makes them available as...
Read more ...

October 10, 2012

Responce once commited, any subsequent redirect operations will throw an IllegalStateException?

public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); String dbValue = getValueFromDB (); if (dbValue == null) response.sendError (HttpServletResponse.SC_NOT_FOUND, "DB Lookup Failed"); response.sendRedirect ("Form.jsp"); } Question: Consider the following code snippet of above servlet code. If the getValueFromDB () method returns...
Read more ...

What will be the output of the following JSP code ?

Jsp Code: <! int a =20> <! int b = 30> <%= b* a> May be bellow answers suitable(chose any one): (A) The code will not compile (B) The value of b multiplied by a is 30 (C) The value of b multiplied by a is 300 (D) The value of b multiplied by a is 600 (E) The value of b multiplied by a is 0 Why The is the correct...
Read more ...

July 27, 2012

Servlets can use four types of scope for the variables

Local scope Page scope Session scope Application or server scope. Local scope: If a variable gets declared inside any method of the servlet or any block then it becomes local scope. Page scope: If a variable can be available to all parts of the servlets and all users share one instance of the variable, then it becomes page scope. An instance or class variable of the servlet can be called as page scope variable. Such types of...
Read more ...

What does the 'load-on-startup' element mean in Deployment Descriptor (web.xml)?

The load-on-startup element indicates that this servlet should be loaded (instantiated and have its init() called) on the startup of the web application. The optional contents of these element must be an integer indicating the order in which the servlet should be loaded. If the value is a negative integer, or the element is not present, the container is free to load the servlet whenever it chooses. If the value is a positive...
Read more ...

June 29, 2012

Setting Up Eclipse with Java 1.6 on Windows

Step 1 - Download JavaStep 2 - Install JavaStep 3 - Set the PATHStep 4 - Set the CLASSPATHStep 5 - Test the Java installationStep 6 - Download and install EclipseStep 7 - Test the Eclipse installationStep 1     Download Java 1.6 package for Windows.  Click the Download button alongside the label  JDK 6 Update 2 (or similar). On that page, accept...
Read more ...

My Favorite Site's List

#update below script more than 500 posts