469,336 Members | 5,278 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

request.getParameter value passing null

14
ok I canged my code around...no more javascript...the problem now is the 'weatherStae" parameter is passing 'null' in request.getParameter...any suggestions??

1st jsp:

Expand|Select|Wrap|Line Numbers
  1. <form name="form1" method="POST" action="/JAABA/jsp/cpanel/cp-weatherFive.jsp">
  2.  
  3. <label for="weatherState">State:</label>
  4.  
  5. <select name="weatherState" >
  6.  
  7. <% for (int i=0; i< theStates.size(); i++) {  %>
  8.  
  9. <OPTION VALUE="<%=theStates.elementAt(i)%>"><%=theStates.elementAt(i)%></OPTION>
  10.  
  11.  
  12.  
  13. <% 
  14. }
  15. %>
  16. </select>
  17.  
  18.  
2nd jsp:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <%
  3. System.out.println("error...: "+request.getParameter("weatherState"));//--this is coming back null??
  4. String sValue = request.getParameter("weatherState");
  5. Vector theCities = WeatherDAO.getWeatherCities(sValue);
  6. %>
  7.  
  8.  
Sep 11 '07 #1
7 14269
dmjpro
2,476 2GB
ok I canged my code around...no more javascript...the problem now is the 'weatherStae" parameter is passing 'null' in request.getParameter...any suggestions??

1st jsp:

Expand|Select|Wrap|Line Numbers
  1. <form name="form1" method="POST" action="/JAABA/jsp/cpanel/cp-weatherFive.jsp">
  2.  
  3. <label for="weatherState">State:</label>
  4.  
  5. <select name="weatherState" >
  6.  
  7. <% for (int i=0; i< theStates.size(); i++) {  %>
  8.  
  9. <OPTION VALUE="<%=theStates.elementAt(i)%>"><%=theStates.elementAt(i)%></OPTION>
  10.  
  11.  
  12.  
  13. <% 
  14. }
  15. %>
  16. </select>
  17.  
  18.  
2nd jsp:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <%
  3. System.out.println("error...: "+request.getParameter("weatherState"));//--this is coming back null??
  4. String sValue = request.getParameter("weatherState");
  5. Vector theCities = WeatherDAO.getWeatherCities(sValue);
  6. %>
  7.  
  8.  
Show me the code of the Form which getting Submitted and calling this Jsp.
You can also try this one, whether weatherState parameter comes or not.

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Enumeration param_names = request.getParameterNames();
  3. while(param_names.hasMoreElements()){ if(param_names.nextElemenet().equals("weatherState")) System.out.println("Yahooo............Parameter found by that name.");
  4. System.out.println("Parameter_Names: " + param_names.nextElemenet());
  5. }
  6. %>
  7.  
Good Luck.

Kind regards,
Dmjpro.
Sep 12 '07 #2
dmjpro
2,476 2GB
ok I canged my code around...no more javascript...the problem now is the 'weatherStae" parameter is passing 'null' in request.getParameter...any suggestions??

1st jsp:

Expand|Select|Wrap|Line Numbers
  1. <form name="form1" method="POST" action="/JAABA/jsp/cpanel/cp-weatherFive.jsp">
  2.  
  3. <label for="weatherState">State:</label>
  4.  
  5. <select name="weatherState" >
  6.  
  7. <% for (int i=0; i< theStates.size(); i++) {  %>
  8.  
  9. <OPTION VALUE="<%=theStates.elementAt(i)%>"><%=theStates.elementAt(i)%></OPTION>
  10.  
  11.  
  12.  
  13. <% 
  14. }
  15. %>
  16. </select>
  17.  
  18.  
2nd jsp:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <%
  3. System.out.println("error...: "+request.getParameter("weatherState"));//--this is coming back null??
  4. String sValue = request.getParameter("weatherState");
  5. Vector theCities = WeatherDAO.getWeatherCities(sValue);
  6. %>
  7.  
  8.  
Let me clarify one thing.
Expand|Select|Wrap|Line Numbers
  1. <label for="weatherState">State:</label>
  2. <select name="weatherState" ></select>
  3.  
Here the name weatherState occurred twice.
Please tell me what is function of first one.......<Label>?

Kind regards,
Dmjpro.
Sep 12 '07 #3
mimsc
14
Let me clarify one thing.
Expand|Select|Wrap|Line Numbers
  1. <label for="weatherState">State:</label>
  2. <select name="weatherState" ></select>
  3.  
Here the name weatherState occurred twice.
Please tell me what is function of first one.......<Label>?

Kind regards,
Dmjpro.

I just noticed that also...im gonna remove that label...and run that...I'll be back with the results
Sep 12 '07 #4
r035198x
13,262 8TB
You are still using Vector ...
Sep 12 '07 #5
mimsc
14
Show me the code of the Form which getting Submitted and calling this Jsp.
You can also try this one, whether weatherState parameter comes or not.

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Enumeration param_names = request.getParameterNames();
  3. while(param_names.hasMoreElements()){ if(param_names.nextElemenet().equals("weatherState")) System.out.println("Yahooo............Parameter found by that name.");
  4. System.out.println("Parameter_Names: " + param_names.nextElemenet());
  5. }
  6. %>
  7.  
Good Luck.

Kind regards,
Dmjpro.
thasnx man..I tried that....this is the message I get: "java.util.NoSuchElementException"

im confused..I thought the request.getParameter() picked up that first label...I removed that and the same thing....can you see anything else...maybe the form??
Sep 12 '07 #6
mimsc
14
You are still using Vector ...
does that matter?...If I hardcode "FL" or any other state in mysecond jsp....no problems
Sep 12 '07 #7
mimsc
14
i figured it out...MINOR problem.....didnt submit the form!!!!!!!!!!!!!...dammit!!!!!
Sep 12 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by wawa_piggy | last post: by
10 posts views Thread by William L. Bahn | last post: by
8 posts views Thread by Angel | last post: by
reply views Thread by buntyindia | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by haryvincent176 | last post: by
reply views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.