1 | What is the result of adding following header?
response.addDateHeader("Expires",-1); |
2 | Which of the following statements are true about GET and POST methods? |
3 | Given following form:
<form action="register.do">
<input type="text" name="Name">
<input type="submit" value="Save">
</form>
and a servlet code:
public class RegisterServlet extends HttpServlet{
pulic void doPost(HttpServletRequest req, HttpServletResponse res) {
// registration logic goes here
return;
}
}
With the above code, assuming the servlet is configured properly and registration logic works good, trying to register user fails.
Choose one reason. |
4 | Which of the following statements are true about setHeader() and addHeader() methods? |
5 | Which HTTP method is used by the client to check what server receives when request is made? |
6 | What is the result of following code, given there already exists a header by name "TestHeader".
response.addHeader("TestHeader","TEST VALUE"); |
7 | Which HTTP method is non - idempotent? |
8 | Given a servlet
public class myServlet extends HttpServlet{
int allowable_connections;
public myServlet(){
allowable_connections = getServletConfig().getInitParameter("allowable_connections");
}
public void service(HttpServletRequest req, HttpServletResponse resp) throws Exception{
PrintWriter out = request.getWriter();
out.println("Allowable connections are:"+allowable_connections);
}
}
Given allowable_connections init parameter's value is defined as 10 in the web.xml for the servlet,
what will happen when a POST request is received for this servlet?
|
9 | I have a init parameter in my web app for remote server name which I connect to in a servlet named ConnectionServlet.The ConnectionServlet reads this parameter in its service() method. Recently I changed my settings and shifted all data to another server by different name and ip. What are minimal things I have to do to make this change take effect? |
10 | My application is throwing various exceptions and I have to redirect to error page when there is some Exception. What are my possible options? |