wood burning stoves*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Exam and WhizLabs!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Exam and WhizLabs!!!" Watch "Exam and WhizLabs!!!" New topic
Author

Exam and WhizLabs!!!

Veri Strora
Greenhorn

Joined: Feb 04, 2003
Posts: 27
Hi All!
In WhizLabs (Exam Simulator) there is the Question:
----------------------------------
<form method="POST" action="/servlet/PostTest">
val1 = <input type='text' name='value1'> <br>
val2 = <input type='text' name='value2'>
<input type='submit' name='AddButton'>
</form>
----------------------------------
public class PostTest extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
response.setContentType("text/plain");
--> BufferedReader inReader = request.getReader();
PrintWriter out = response.getWriter();
out.println("Manually val1Str: " + inReader.readLine());
out.println("Manually val2Str: " + inReader.readLine());

out.println("Val1 param: " + request.getParameter("value1"));
out.println("Val2 param: " + request.getParameter("value2"));
}
}
-----------------------------------
The Author suggest as right Response:
Manually val1Str: value1=1&value2=1&AddButton=Premi%21
Manually val2Str: null
Val1 param: null
Val2 param: null
But this don't function giving me the message:
java.lang.IllegalStateException: getReader() has already been called for this request
at org.apache.catalina.connector.RequestBase.getInputStream etc...
------------------------------
How the exam authors think about this question?
Thanks Veri.
 
GeeCON Prague 2014
 
subject: Exam and WhizLabs!!!