request.getParameter value passing null

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mimsc
    New Member
    • Sep 2007
    • 14

    #1

    request.getParameter value passing null

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

    1st jsp:

    Code:
    <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)%>"><%=theStates.elementAt(i)%></OPTION>
    
    
    
    <% 
    }
    %>
    </select>
    2nd jsp:

    Code:
    <%
    System.out.println("error...: "+request.getParameter("weatherState"));//--this is coming back null??
    String sValue = request.getParameter("weatherState");
    Vector theCities = WeatherDAO.getWeatherCities(sValue);
    %>
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    Originally posted by mimsc
    ok I canged my code around...no more javascript...th e problem now is the 'weatherStae" parameter is passing 'null' in request.getPara meter...any suggestions??

    1st jsp:

    Code:
    <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)%>"><%=theStates.elementAt(i)%></OPTION>
    
    
    
    <% 
    }
    %>
    </select>
    2nd jsp:

    Code:
    <%
    System.out.println("error...: "+request.getParameter("weatherState"));//--this is coming back null??
    String sValue = request.getParameter("weatherState");
    Vector theCities = WeatherDAO.getWeatherCities(sValue);
    %>
    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.

    [code=jsp]
    <%
    Enumeration param_names = request.getPara meterNames();
    while(param_nam es.hasMoreEleme nts()){ if(param_names. nextElemenet(). equals("weather State")) System.out.prin tln("Yahooo.... ........Paramet er found by that name.");
    System.out.prin tln("Parameter_ Names: " + param_names.nex tElemenet());
    }
    %>
    [/code]
    Good Luck.

    Kind regards,
    Dmjpro.

    Comment

    • dmjpro
      Top Contributor
      • Jan 2007
      • 2476

      #3
      Originally posted by mimsc
      ok I canged my code around...no more javascript...th e problem now is the 'weatherStae" parameter is passing 'null' in request.getPara meter...any suggestions??

      1st jsp:

      Code:
      <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)%>"><%=theStates.elementAt(i)%></OPTION>
      
      
      
      <% 
      }
      %>
      </select>
      2nd jsp:

      Code:
      <%
      System.out.println("error...: "+request.getParameter("weatherState"));//--this is coming back null??
      String sValue = request.getParameter("weatherState");
      Vector theCities = WeatherDAO.getWeatherCities(sValue);
      %>
      Let me clarify one thing.
      [code=html]
      <label for="weatherSta te">State:</label>
      <select name="weatherSt ate" ></select>
      [/code]

      Here the name weatherState occurred twice.
      Please tell me what is function of first one.......<Label>?

      Kind regards,
      Dmjpro.

      Comment

      • mimsc
        New Member
        • Sep 2007
        • 14

        #4
        Originally posted by dmjpro
        Let me clarify one thing.
        [code=html]
        <label for="weatherSta te">State:</label>
        <select name="weatherSt ate" ></select>
        [/code]

        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

        Comment

        • r035198x
          MVP
          • Sep 2006
          • 13225

          #5
          You are still using Vector ...

          Comment

          • mimsc
            New Member
            • Sep 2007
            • 14

            #6
            Originally posted by dmjpro
            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.

            [code=jsp]
            <%
            Enumeration param_names = request.getPara meterNames();
            while(param_nam es.hasMoreEleme nts()){ if(param_names. nextElemenet(). equals("weather State")) System.out.prin tln("Yahooo.... ........Paramet er found by that name.");
            System.out.prin tln("Parameter_ Names: " + param_names.nex tElemenet());
            }
            %>
            [/code]
            Good Luck.

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

            im confused..I thought the request.getPara meter() picked up that first label...I removed that and the same thing....can you see anything else...maybe the form??

            Comment

            • mimsc
              New Member
              • Sep 2007
              • 14

              #7
              Originally posted by r035198x
              You are still using Vector ...
              does that matter?...If I hardcode "FL" or any other state in mysecond jsp....no problems

              Comment

              • mimsc
                New Member
                • Sep 2007
                • 14

                #8
                i figured it out...MINOR problem.....did nt submit the form!!!!!!!!!!! !!...dammit!!!! !

                Comment

                Working...