943,794 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Unsolved
  • Views: 16994
  • JSP RSS
Sep 11th, 2007
0

request.getParameter value passing null

Expand Post »
any suggestions...my "weatherState" value doesnt seem to be passing over:

1st jsp:

JSP Syntax (Toggle Plain Text)
  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:

JSP Syntax (Toggle Plain Text)
  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. %>
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
mimsc is offline Offline
70 posts
since Aug 2007
Sep 12th, 2007
0

Re: request.getParameter value passing null

ha..no luck i guess
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
mimsc is offline Offline
70 posts
since Aug 2007
Sep 16th, 2007
0

Re: request.getParameter value passing null

Click to Expand / Collapse  Quote originally posted by mimsc ...
JSP Syntax (Toggle Plain Text)
  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.
JSP Syntax (Toggle Plain Text)
  1. <select id="weatherState" name="weatherState" >
Reputation Points: 48
Solved Threads: 7
Posting Whiz
aniseed is offline Offline
353 posts
since Apr 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: can anybody guide me
Next Thread in JSP Forum Timeline: Another MySQL issue...





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC