request.getParameter value passing null

Reply

Join Date: Aug 2007
Posts: 66
Reputation: mimsc is an unknown quantity at this point 
Solved Threads: 0
mimsc mimsc is offline Offline
Junior Poster in Training

request.getParameter value passing null

 
0
  #1
Sep 11th, 2007
any suggestions...my "weatherState" value doesnt seem to be passing over:

1st jsp:

  1. <%
  2. Vector theStates = WeatherDAO.getWeatherStates();
  3. %>
  4.  
  5.  
  6. <html>
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  9. <title>Insert title here</title>
  10.  
  11. </script>
  12.  
  13. <body>
  14.  
  15.  
  16.  
  17.  
  18. <TR bgColor="#ffffff"><TD COLSPAN="2">
  19. <TABLE CELLPADDING="3" CELLSPACING="2">
  20. <TR><TD>
  21.  
  22. </FONT></CENTER><BR>
  23. <BR>
  24. <TABLE BORDER="0" CELLSPACING="5" CELLPADDING="5" WIDTH="100%">
  25. <TR BGCOLOR="#C0C0C0" ><TD COLSPAN="2" ALIGN="CENTER"> <FONT SIZE=+3><B> Weather Services</B></FONT>
  26. </TD></TR>
  27. </TABLE>
  28. <HR SIZE="3" NOSHADE>
  29. <font size=+1>Choose a state and press continue</font><br>
  30. <TR><TD>
  31. <center>
  32.  
  33. <form name="form1" method="POST" action="/JAABA/jsp/cpanel/cp-weatherFive.jsp">
  34.  
  35. <label for="weatherState">State:</label>
  36.  
  37. <select name="weatherState" >
  38.  
  39. <% for (int i=0; i< theStates.size(); i++) { %>
  40.  
  41. <OPTION VALUE><%=theStates.elementAt(i)%></OPTION>
  42.  
  43.  
  44.  
  45. <%
  46. }
  47. %>

2nd jsp:

  1.  
  2. <%
  3. System.out.println("error...: "+request.getParameter("weatherState"));
  4. String sValue = request.getParameter("weatherState");
  5. Vector theCities = WeatherDAO.getWeatherCities(sValue);
  6. %>
  7.  
  8.  
  9. <html>
  10. <head>
  11. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  12. <title>Insert title here</title>
  13.  
  14.  
  15.  
  16. <body>
  17.  
  18.  
  19.  
  20.  
  21. <TR bgColor="#ffffff"><TD COLSPAN="2">
  22. <TABLE CELLPADDING="3" CELLSPACING="2">
  23. <TR><TD>
  24.  
  25. </FONT></CENTER><BR>
  26. <BR>
  27. <TABLE BORDER="0" CELLSPACING="5" CELLPADDING="5" WIDTH="100%">
  28. <TR BGCOLOR="#C0C0C0" ><TD COLSPAN="2" ALIGN="CENTER"> <FONT SIZE=+3><B> Weather Services</B></FONT>
  29. </TD></TR>
  30. </TABLE>
  31. <HR SIZE="3" NOSHADE>
  32. <font size=+1>Select the State and City for which you would like to receive weather information.</font><br>
  33. <TR><TD>
  34. <center>
  35.  
  36.  
  37. <label for="weatherCity">City:</label>
  38.  
  39. <select name="weatherCity" >
  40.  
  41. <% for (int i=0; i< theCities.size(); i++) { %>
  42.  
  43. <OPTION VALUE=<%=theCities%>> <%=theCities.elementAt(i)%> </OPTION>
  44.  
  45. <%
  46. }
  47. %>
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 66
Reputation: mimsc is an unknown quantity at this point 
Solved Threads: 0
mimsc mimsc is offline Offline
Junior Poster in Training

Re: request.getParameter value passing null

 
0
  #2
Sep 12th, 2007
ha..no luck i guess
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 353
Reputation: aniseed is an unknown quantity at this point 
Solved Threads: 6
aniseed's Avatar
aniseed aniseed is offline Offline
Posting Whiz

Re: request.getParameter value passing null

 
0
  #3
Sep 16th, 2007
Originally Posted by mimsc View Post
  1. <select name="weatherState" >
It could probably be because you need to specify id for the select element. Some browsers pass data based on id, others based on the name attribute. To be safe, it is a good practice to define the id and the name.
  1. <select id="weatherState" name="weatherState" >
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 11325 | Replies: 2
Thread Tools Search this Thread



Tag cloud for JSP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC