473,471 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

request.getParameter value passing null

14 New Member
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 14665
dmjpro
2,476 Top Contributor
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 Top Contributor
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 New Member
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 MVP
You are still using Vector ...
Sep 12 '07 #5
mimsc
14 New Member
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 New Member
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 New Member
i figured it out...MINOR problem.....didnt submit the form!!!!!!!!!!!!!...dammit!!!!!
Sep 12 '07 #8

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

Similar topics

1
by: efiedler | last post by:
Hi - I have the following input field on my html page: <input type="image" name="submit" id="submit" src="c:\image.jpg" value="image.jpg"> I also have another input field on the form that is...
9
by: Sunny | last post by:
Hi, I have cr8ed a javascript function in the head section of a jsp page. <!-- function go(theURL) { alert(theURL); if (theURL!=null){
3
by: jrefactors | last post by:
page0.asp->page1.jsp When the user click submit button in page0.asp, it will post the form request to page1.jsp. page0.asp and page1.jsp are in separate machines. In page1.jsp, based on the...
1
by: wawa_piggy | last post by:
My .net application is to consume a Java web services exposed using AXIS. The web service will extract the user name and password to perform some custom authentication. /** Java **/ userId =...
10
by: William L. Bahn | last post by:
I'm looking for a few kinds of feedback here. First, there is a program at the end of this post that has a function kgets() that I would like any feedback on - including style. Second, for...
8
by: Angel | last post by:
I am trying to access in Javascript within an ASP.NET web page the Request Object. I am specifically trying to access the values in the Request.QueryString. When I try to access the values I get an...
6
by: santhoskumara | last post by:
How to request to servlet from Ajax and also I got the DOM object in the servlet through Business Logic. Now how will i pass the DOM object from serlvet to Clientside. Where in the client Side i am...
0
by: buntyindia | last post by:
Hi, I have a very strange problem with my application. I have developed it using Struts. I have a TextBox With Some fixed value in it and on Submit iam passing it to another page. <html:form...
3
by: vijaykumardahiya | last post by:
Dear Sir, I have two queries. First question is: I have a Html page. On which Have two buttons Submit and Issue. I want when I click on Sumit button request should be go to submit.jsp. and When I...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.