• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

servlet+html

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the problem may be small bt i m getting null value from drop down box in html to servlet.
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More info please.
 
manoswa kapoor
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wish to get the values from the drop down menu selected by a user from the HTML page and pass this value into my servlet program for processing.

In my servlet program, I've used the getParameter() function to obtain the value from the drop down menu selected.


<SELECT name=Day>
<OPTION value="" selected>- Select -</OPTION>
<OPTION value=Sunday>Sunday</OPTION>
<OPTION value=Monday>Monday</OPTION>
<OPTION value=Tuesday>Tuesday</OPTION>
<OPTION value=Wednesday>Wednesday</OPTION>
<OPTION value=Thursday>Thursday</OPTION>
<OPTION value=Friday>Friday</OPTION>
<OPTION value=Saturday>Saturday</OPTION>
</SELECT>


String days= request.getParameter("Day");
System.out.println("DAY =" +days);

However, the value of the parameter "day" seems empty. May I know what is the correct method of getting the value selected from the drop down menu into my servlet? It did work when I use Javascript functions to extract it though (function getDay() in frmLockOut.html).
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The statement looks fine to me. Are you sure that the servlet is executing as a result of the submission of a form that contains the select element?
 
manoswa kapoor
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry the problem was very miner thanks for pointing out.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic