• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exam and WhizLabs!!!  RSS feed

Veri Strora
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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'>
public class PostTest extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
--> 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!