Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP select box - servlet

 
Michael Waserman
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65110
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First step: have you checked the formatting of the HTML that is sent to the browser?
[ July 13, 2004: Message edited by: Bear Bibeault ]
 
Michael Waserman
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic