1

I'm using eclipse. I have a login form like this

<form method="post" action="login">
    <p>Login</p>
    <input type="text" id="email"/><br>
    <input type="text" id="password"/><br>
    <input type="submit" value="GET STARTED"/>          
</form>

when I use request.getParameter("email") in the servlet, it doesn't give me the input value because I don't specify the name of input. So I add the name attribute.

<form method="post" action="login">
    <p>Login</p>
    <input type="text" id="email" name="email"/><br>
    <input type="text" id="password" name="password"/><br>
    <input type="submit" value="GET STARTED"/>          
</form>

But still I don't get the input value. Then after 1+ hour of invalid debugging, I exit the eclipse. Then I restart the eclipse again, the problem is gone.

I guess does it have something to do with "how the IDE mapping form input values" and stuff? I tried clearing the cache of eclipse, but it turned out not related to the issue.

Anyone can explain what happened here? Thanks!


Update in 0504:

It has something to do with the IDE's web browser, although I don't know exactly what the problem is. I change to use the external Chrome and it works fine there.

Max
  • 129
  • 8
  • Please paste your servlet code aswell. – Orcun Yucel May 14 '15 at 13:38
  • it's like System.out.println(request.getParameter("email")); – Max May 14 '15 at 13:57
  • full source code could be better but are you trying to write the output to eclipse console or to the webpage? Because if you wanna see the output on web page you need to write out.println(request.getParameter("email")); because System.out.println(request.getParameter("email")); will write the output to somewhere else as described on [Where System.out writes in a servlet?](http://stackoverflow.com/questions/11986296/where-system-out-writes-in-a-servlet) – Orcun Yucel May 14 '15 at 14:21
  • Thanks for your thought. I use `system.out` because i just want to see the output in the console. Using `out` certainly is another legit approach. – Max May 14 '15 at 17:43

1 Answers1

0

The second code should have worked here. Its the name attribute that gets posted in the form submit. I guess, you forgot to save or the saved code was somehow not deployed in the Application server.

Rajan
  • 1,501
  • 4
  • 21
  • 37