aspose file tools*
The moose likes Servlets and the fly likes Dropdown values not submitted Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Dropdown values not submitted" Watch "Dropdown values not submitted" New topic
Author

Dropdown values not submitted

Sonx Nkuks
Ranch Hand

Joined: Aug 20, 2010
Posts: 47
Hi, i have the following form

and this is how i plan to get the values

only "parameters exhausted ...." is displayed which means the param list is null/empty... Is JSTL setting 'username' parameter?
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

what do you see in the HTML source for the select?
Sonx Nkuks
Ranch Hand

Joined: Aug 20, 2010
Posts: 47
David O'Meara wrote:what do you see in the HTML source for the select?

i had to set the selected value to get it working


But still the getParameterNames didn't get me the values. I had to change code to the following to get it to work, not sure why
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I believe this is the correct behaviour, that is
1) if no value is selected, then the parameter name is not sent in the request, and getParameter() returns null
2) if a value is selected, then the parameter exists and the value is defined.

One solution is to provide a default value with an empty value, such as
Vishwanath Krishnamurthi
Ranch Hand

Joined: Jun 04, 2007
Posts: 331
Hi,

Sonx Nkuks wrote:Hi, i have the following form


Here, you have given the submit-button the same name you've given for your select box. You don't need a name for a submit button. Even if you provide, it'd be better to use a unique name.

HTH,
Vishwa


Blog
Sonx Nkuks
Ranch Hand

Joined: Aug 20, 2010
Posts: 47
Vishwanath Krishnamurthi wrote:Hi,

Sonx Nkuks wrote:Hi, i have the following form


Here, you have given the submit-button the same name you've given for your select box. You don't need a name for a submit button. Even if you provide, it'd be better to use a unique name.

HTH,
Vishwa


I removed the name attribute and gave it the value attribute... Another question on HTML, i need to do two things

1. Pass a list of objects from doGet() to doPost() .. should i just put it on HttpSession?
2. Keep track of the EJBRemote reference so that i don't have to look it up on the JNDI context everytime i need it. I tried putting it on the HttpSession but it becomes null

Thanks
Sonx Nkuks
Ranch Hand

Joined: Aug 20, 2010
Posts: 47
Th e HttpSession seems to be working for both
 
 
subject: Dropdown values not submitted