aspose file tools*
The moose likes Servlets and the fly likes servlet+html Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet+html" Watch "servlet+html" New topic
Author

servlet+html

manoswa kapoor
Greenhorn

Joined: Oct 10, 2008
Posts: 12
the problem may be small bt i m getting null value from drop down box in html to servlet.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61232
    
  66

More info please.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
manoswa kapoor
Greenhorn

Joined: Oct 10, 2008
Posts: 12
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
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61232
    
  66

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

Joined: Oct 10, 2008
Posts: 12
sorry the problem was very miner thanks for pointing out.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet+html