Java Servlets and JSP

Test your knowledge of Java web technologies including Servlets, JavaServer Pages (JSP), HTTP request handling, web.xml configuration, JSP actions, and JavaBean integration.

11 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following built-in Integration Server services is primarily used for exception handling?

  1. pub.flow:catchException
  2. pub.flow:catchError
  3. pub.schema:validatePipeline
  4. pub.flow:getLastError
Question 2 Multiple Choice (Single Answer)

Which of the following can the JSP include action include output from?

  1. JSP File
  2. Plain text file
  3. SERVLET
  4. All of the above
Question 3 Multiple Choice (Single Answer)

jsp:include/ action can pass parameters to the page which it is including. How does the next page obtain the value of these parameters?

  1. Using the <jsp:readParam/> action
  2. Using the <jsp:getParam/> action
  3. Use the request.getParameter() method
  4. Use the response.getParameter() method
Question 4 Multiple Choice (Single Answer)

What is wrong with the following code? <% if(strPassword.equals("boss")) { <jsp:forward page="Welcome.jsp" flush="true"/> } else { <jsp:forward page="Login.jsp" flush="true"/> } %>

  1. Unmatched bracket in for statement
  2. Flush attribute must be false
  3. Keyword 'file' should be used instead of 'page' in the <jsp:forward/> action
  4. Actions cannot be used within scriptlet blocks
Question 5 Multiple Choice (Single Answer)

What is wrong with the following code?

  1. Cookie class can not take parameters in it's constructor
  2. The request object is used for creating cookies
  3. Although no error will be reported the use of the <jsp:include/> action means that the response object can't be used to create cookies
  4. The <jsp:include/> action must be placed inside the script block
Question 6 True/False

In both jsp:setProperty/ and jsp:getProperty/ the attributes can take JSP expressions as values, for example <jsp:setProperty name="employeeBean" property="firstName" value="<%= strFirst %>" />

  1. True
  2. False
Question 7 Multiple Choice (Single Answer)

To synchronise an HTML form with a JavaBean you would add which of the following statements

  1. <jsp:synchronize name="BeanName" />
  2. <jsp:setProperty name="BeanName" property="" />
  3. <jsp:setProperty name="BeanName" property="*" />
  4. <jsp:setProperty name="BeanName" property="All" />
Question 8 Multiple Choice (Single Answer)

In which file do we define a servlet mapping ?

  1. web.xml
  2. servlet.mappings
  3. servlet.xml
  4. Servlet.java
Question 9 Multiple Choice (Single Answer)

Servlets and JavaServer Pages have become so popular that they are now supported directly or with third-party plug-ins by most major Web servers and application servers?

  1. True
  2. False
  3. Can't say
  4. None of these
Question 10 Multiple Choice (Single Answer)

All servlets must implement the Servlet interface of package?

  1. java.servlet
  2. javax.servlet
  3. .servlet
  4. All are same
Question 11 Multiple Choice (Single Answer)

A get request gets information from a client. A post request posts data to a client?

  1. True
  2. False
  3. Not always
  4. None of these