User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 456,467 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,768 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 5873 | Replies: 2
Reply
Join Date: Aug 2007
Posts: 40
Reputation: mimsc is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
mimsc mimsc is offline Offline
Light Poster

request.getParameter value passing null

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

1st jsp:

<%
Vector theStates = WeatherDAO.getWeatherStates();
%>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>

</script>

<body>




<TR bgColor="#ffffff"><TD COLSPAN="2">
<TABLE CELLPADDING="3" CELLSPACING="2">
<TR><TD>

</FONT></CENTER><BR>
<BR>
<TABLE BORDER="0" CELLSPACING="5" CELLPADDING="5" WIDTH="100%">
<TR BGCOLOR="#C0C0C0" ><TD COLSPAN="2" ALIGN="CENTER"> <FONT SIZE=+3><B> Weather Services</B></FONT>
</TD></TR>
</TABLE>
<HR SIZE="3" NOSHADE>
<font size=+1>Choose a state and press continue</font><br>
<TR><TD> 
<center>

<form name="form1" method="POST" action="/JAABA/jsp/cpanel/cp-weatherFive.jsp">
  
<label for="weatherState">State:</label>

<select name="weatherState" >

<% for (int i=0; i< theStates.size(); i++) {  %>

<OPTION VALUE><%=theStates.elementAt(i)%></OPTION>



<% 
}
%>

2nd jsp:

<%
System.out.println("error...: "+request.getParameter("weatherState"));
String sValue = request.getParameter("weatherState");
Vector theCities = WeatherDAO.getWeatherCities(sValue);
%>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>



<body>




<TR bgColor="#ffffff"><TD COLSPAN="2">
<TABLE CELLPADDING="3" CELLSPACING="2">
<TR><TD>

</FONT></CENTER><BR>
<BR>
<TABLE BORDER="0" CELLSPACING="5" CELLPADDING="5" WIDTH="100%">
<TR BGCOLOR="#C0C0C0" ><TD COLSPAN="2" ALIGN="CENTER"> <FONT SIZE=+3><B> Weather Services</B></FONT>
</TD></TR>
</TABLE>
<HR SIZE="3" NOSHADE>
<font size=+1>Select the State and City for which you would like to receive weather information.</font><br>
<TR><TD> 
<center>


<label for="weatherCity">City:</label>

<select name="weatherCity" > 

<% for (int i=0; i< theCities.size(); i++) {  %>

<OPTION VALUE=<%=theCities%>> <%=theCities.elementAt(i)%> </OPTION>

<% 
}
%>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2007
Posts: 40
Reputation: mimsc is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
mimsc mimsc is offline Offline
Light Poster

Re: request.getParameter value passing null

  #2  
Sep 12th, 2007
ha..no luck i guess
Reply With Quote  
Join Date: Apr 2006
Location: Mumbai, India
Posts: 351
Reputation: aniseed is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 5
aniseed's Avatar
aniseed aniseed is offline Offline
Posting Whiz

Re: request.getParameter value passing null

  #3  
Sep 16th, 2007
Originally Posted by mimsc View Post
<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.
<select id="weatherState" name="weatherState" >
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JSP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 2:21 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC