my dog learned polymorphism*
The moose likes HTML, CSS and JavaScript and the fly likes JSP select box - servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JSP select box - servlet" Watch "JSP select box - servlet" New topic
Author

JSP select box - servlet

Michael Waserman
Greenhorn

Joined: Jul 10, 2004
Posts: 28
What could be the reason the selected value does not get transmitted to the servlet in the following code:

<select name="choice" size="15">
<option value="choose" selected>Please select #</option>

<%String batchNum = "";
AbstractList beans = (AbstractList)request.getAttribute ("mylist");
Iterator iterator = beans.iterator();
int i = 1;
while (iterator.hasNext()){
GetDataBean bean = (GetDataBean) iterator.next();
batchNum = bean.getBatchNum();
i++;
%>
<option value="<%= batchNum %>"><%= batchNum %></option>
<% } %>
</select>

Your responce is greately appreciated. Thanks. Mike.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

First step: have you checked the formatting of the HTML that is sent to the browser?
[ July 13, 2004: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Michael Waserman
Greenhorn

Joined: Jul 10, 2004
Posts: 28
Bear,
I submit the form using the button as follows:

<script LANGUAGE="JavaScript">
function sendApprove(aForm){
aForm.action = "/servlet/BatchApprServlet3";
aForm.submit();
</script>

<input type="button" name="approve" value = " Approve " onKlick="sendApprove(this.form)">

Thanks. Mike.
 
jQuery in Action, 2nd edition
 
subject: JSP select box - servlet
 
Similar Threads
servlet+html
How pass the selected values of the Combo box to the servlet....
How pass the selected values of the Combo box to the servlet....
How to set Default selection in h:selectOneMenu
My Small Web Project - but has some problems - please help ...