A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Issue with POST and Forms
Joined: Jan 01, 2007
Feb 17, 2007 18:32:00
I have this code:
<form method="POST" action="test.do"> Select Beer Characteristics<p> Color: <select name="color" size="1"> <option>light</option> <option>brown</option> <option>amber</option> <option>dark</option> </select> <br><br> <center> <input type="SUBMIT"> </center> </form>
then inside of doGet for my
i have this:
// output selected color String c = request.getParameter("color"); out.print( c ); // printing out the variable c always says "null"...
The output is always null...
what the heck am i doing wrong? I want it to say light if the user chose light, dark if they pick dark etc ...
what little thing am i forgetting?
Joined: Feb 07, 2005
Feb 17, 2007 19:26:00
Did you mean inside of doPost?
Joined: Dec 14, 2006
Feb 18, 2007 05:05:00
Your method attributes indicates the HTTP request is of type POST.
You should write the above logic in doPost() but not in doGet().
The default http request is GET.
subject: Issue with POST and Forms
servlet programming problem in Eclipse
HFSJ 2nd edition page 75
Problem getting the Beer Selection Page screen shot
HFS: Problem with deploying and testing Beer-v1 App
HTTP Status 404 Error
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015