Hi,
please do share ur answers/opinions regarding foll. questions:
Q. Which statement is true about the JSP code below?
<%try
{
FileWriter fr=new FileWriter(targetFile,true);
fr.write("Some message");
fr.close();
}
catch(IOException ioex){}%>
a. That is not JSP
b. It should throw ServletException, not IOException
c. Code executes fine
d. FileWriter cannot be used on server
Q. What is the key difference between using a <jsp:forward> and HttpServletResponse.sendRedirect()?
a. forward executes on the client while sendRedirect() executes on the server.
b. forward executes on the server while sendRedirect() executes on the client.
c. both execute on the server.
d. both execute on the client.
Q. You have a .jsp page with an included file (myPage.jsp, with <%@ include file = 'includedFile.jsp'>

. When you delete or modify the included file on the server, the old one may still shows in the browser. This can be resolved by -
a. restarting the server.
b. deleting the generated servlet.
c. manually refreshing/reloading the whole page (i.e. refresh 'myPage.jsp')
d. not possible to resolve.
Q. Read the code below.
public int doStartTag(){
try
{
JspWriter out=pageContext.getOut();
HttpSession session=pageContext.getSession();
session.setAttribute("TestValue","Hi there");
String s=(String)session.getAttribute("TestValue");
out.println("" + s);
}
What will be the result if this code is executed?
a. It prints 'Hi there'
b. It prints blank
c. It prints 'Hi'
d. It will not compile as HttpSession is an abstract class
Q. Which of the following statements are true ?
Each time the server receives a request for a servlet, the service method is called.
1. TLD tags never have dashes.
2. Overriding the service method should always be done.
3. A servlet cannot have more than 256 init parameters.
a. 1
b. 2 and 3
c. 3
d. 3 and 4
- prat.