Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't retrieve form value on POST 1

Status
Not open for further replies.

Twofy

Programmer
Jan 31, 2003
8
0
0
FR
Hello

I have a servlet that display a form, running on Tomcat4.
When I "POST" the result, java return me only "null" values with the line : request.getParameter("myField");

Does somebody know what append?

Thanks.
 
Perhaps you would like to post your doPost() method from the servlet ? I tried to telepathically read the code via your post, but it didn't seem to work :(

It would also be handy to post aome example request parameters also ...

--------------------------------------------------
Free Database Connection Pooling Software
 
First, thanks for your help.

I'm using velocity template engine, that mix doGet() and doPost() in the same method : handleRequest()

Here the only significant code from this method :

Code:
public Template handleRequest( HttpServletRequest request,
                                 HttpServletResponse response,
                                 Context context )
  {
String st1 = request.getParameter("userName");
logger.debug("Read userName: " + userName);
}
And the form associated (HTML4.1 strict certified) :
Code:
<form method="post" action="/WebSpecif/connection" enctype="text/plain"><p>
          <label for="iduser">User name :</label>
	    <select id="iduser" name="userName">          
            <option value="Leon">Leon</option>
	      <option value="Lea">Lea</option>
	      <option value="Leo">Leo</option>
	    </select><br>
	    <input type="submit" value="Send" size="30"><input type="reset" value="Blank" size="30">
	  </p>
	  </form>

I'm using JBuilder6Pro to trace the execution.

Does this help you to see my problem?
Thanks again for your help.
 
Change :

Code:
<form method="post" action="test1.jsp" enctype="text/plain">
to :
Code:
<form method="post" action="test1.jsp" enctype="text/html">
or remove the enctype altogether.

Cheers.

--------------------------------------------------
Free Database Connection Pooling Software
 
Damn! I don't understand why the hell this modification work this time (i tried it yesterday), but it does : now IE6 give me back the right value, and that's all I wanted (even if JBuilder integrated browser still return 'null').

So, I don't know what spell you cast over my computer, but I sincerely thank you for it, sedj ;)

A great "thank you" for your help.
 
You're very welcome !

Don't forget to chnage the action target though ...

--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top