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.
Questions
Which of the following built-in Integration Server services is primarily used for exception handling?
- pub.flow:catchException
- pub.flow:catchError
- pub.schema:validatePipeline
- pub.flow:getLastError
Which of the following can the JSP include action include output from?
- JSP File
- Plain text file
- SERVLET
- All of the above
jsp:include/ action can pass parameters to the page which it is including. How does the next page obtain the value of these parameters?
- Using the <jsp:readParam/> action
- Using the <jsp:getParam/> action
- Use the request.getParameter() method
- Use the response.getParameter() method
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"/> } %>
- Unmatched bracket in for statement
- Flush attribute must be false
- Keyword 'file' should be used instead of 'page' in the <jsp:forward/> action
- Actions cannot be used within scriptlet blocks
What is wrong with the following code?
- Cookie class can not take parameters in it's constructor
- The request object is used for creating cookies
- 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
- The <jsp:include/> action must be placed inside the script block
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 %>" />
- True
- False
To synchronise an HTML form with a JavaBean you would add which of the following statements
- <jsp:synchronize name="BeanName" />
- <jsp:setProperty name="BeanName" property="" />
- <jsp:setProperty name="BeanName" property="*" />
- <jsp:setProperty name="BeanName" property="All" />
In which file do we define a servlet mapping ?
- web.xml
- servlet.mappings
- servlet.xml
- Servlet.java
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?
- True
- False
- Can't say
- None of these
All servlets must implement the Servlet interface of package?
- java.servlet
- javax.servlet
- .servlet
- All are same
A get request gets information from a client. A post request posts data to a client?
- True
- False
- Not always
- None of these