Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE isn't passing form data

Status
Not open for further replies.

CrystalAgentMan

Programmer
Nov 3, 2003
19
CA
Hello all,
I have a simple test JSP page for passing a couple form TEXT inputs to a 2nd JSP that re-displays. Actually it does some DB work, and redirects back to 1st for re-disply; but i've created an even simpler implmentation that still doesn't work.

The problem is, IE is passing NULLs for all my field values, where other browsers are working like a charm. Is there something totally stupid that i've overlooked (PS : i've built many form pages before that worked).

****** INPUT PAGE ******
<form name="sample1" id="sample1" action="form_1_POST.jsp" method="post">
text 1 : <input type="text" name="text1" id="text1" maxlength="25" value="" />
<br />
text 2 : <input type="text" name="text2" id="text2" maxlength="25" value="" />
<br />
<input type="submit" value="submit" />
<input type="reset" value="reset" />
</form>



****** OUTPUT PAGE ******
text 1 : <%= request.getParameter("text1") %>
<br />
text 2 : <%= request.getParameter("text2") %>


... The output keeps showing NULL when done in IE....i DON"T GET IT :(


thanks for any insight.
 
What are you expecting to be passed ?

As it stands, the forms two values are null strings ...

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Hey sedj,
what i'm expecting is that when the user enters values in the first page, it should pass them to the 2nd page. Where FireFox does this perfectly IE just passes NULLs.

Thanks,
Michael
 
Hey sedj,
Basically, all i want is IE to pass data as if it were a better browser. If there is something fundamentally stupid about my simple pages I'd like to know, but with my eyes having looked at it soooo much i can't figure the problem. As the: <%= request.getParameter("text1") %> should have the ability to read the previous pages form data that got "posted" to the current page.
 
well, thats fine, but the values in that form are null strings - so either you are not posting something, or you misunderstand how to pass values as request parameters ...

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Hey sedj,
Actually, the first page present blank text fields for a user to enter information. If you were to enter info with IE, you would not see it go to the 2nd page; however, if you were to use FF the data you enter does go.

Let's modify the 1st HTML a little as:
****** form_GET.jsp *******
<html>
<form name="sample1" id="sample1" action="form_POST.jsp" method="post">
text 1 : <input type="text" name="text1" id="text1" maxlength="25" value="MyName" />
<br />
text 2 : <input type="text" name="text2" id="text2" maxlength="25" value="MyPhoneNumber" />
<br />
<input type="submit" value="submit" />
<input type="reset" value="reset" />
</form>
</html>


****** form_POST.jsp *******
<html>
text 1 : <%= request.getParameter("text1") %>
<br />
text 2 : <%= request.getParameter("text2") %>
</html>
 
Crikey, I'm going bonkers - yes of course the values won't (or rather shouldn't be null) - I apologise for not realising that before !

So lets start again :)

OK, on the face of it, all looks well.
I saved those two pages on my poota, running tomcat 5.0.28, and it works fine in IE 6 .

As proof, I also chucked them on my server so you can test them - they work fine for me ...


Do they work for you ?



--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Well, of course they work for me.

now i'm just more confused.

I've just confirmed that it works on all of my other servers, just not the one I need it to work on. I've reinstalled Tomcat 4 & 5, and it's bunk in both. So I guess it's my JDK build.


Thanks for your time sedj.
I'll whine again later if still broken after re-installing JDK.
 
OMG.
So far i've installed it on numerous machines, and nothing is working.

I'm biased towards Tomcat 4.1, and am running it on top of JDK 1.4 and 1.5. Both machines pass NULLs when using IE.

I just don't get it. I'll try Tomcat5 in a few minutes, but i really wish i could trouble shoot why IE isn't passing any values. It's not a complex form and just doesn't make any sense.

Thanks again,
Michael
 
and that's a big NO.

even with JDK 1.5.0.04 and tomcat 5.5.9 it still doesn't pass the data. I haven't tweaked the JDK or Tomcat at all other than just dropping these two files, and i'm getting nothing to pass when using IE.

argh.
 
Well, here is my simple page for submitting some random information to my database.

firstpage.jsp
Code:
<%
// all of the raw Java code works
String userName = NADFC.NTLM.getNTuser(response, request);
NADFC.DB.NADFCdb mydb = new NADFC.DB.NADFCdb();
String sqlSELECT = "SELECT Dress_Pant_Size, Shirt_Size, Hat_Size, Shoe_Size FROM t_Sizes WHERE UserName LIKE '" + userName + "'";
String results[][] = mydb.executeSELECT(sqlSELECT);
%>

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html>
<head>
  <title>NADFC</title>
  <link rel="stylesheet" type="text/css" href="/NADFC/CSS/global.css" />
</head>
<body>
  <div align="center">
      <form name="sizes" id="sizes" action="sizes_post.jsp" method="post">  <!-- to JSP page -->
        <table border="0">
          <tr>
            <th align="right">Name :</th>
            <td align="left">
              <input type="hidden" name="userName1" id="userName1" value="<%= userName %>" />
              <input type="text" name="userName2" id="userName2" value="<%= userName %>" disabled="disabled" />
            </td>
          </tr>
          <tr>
            <th align="right">Dress/Pant Size :</th>
            <td align="left">
              <select name="leggingSize" id="leggingSize">
                <option value="S">S</option>
                <option value="M">M</option>
                <option value="L">L</option>
                <option value="XL">XL</option>
              </select>
            </td>
          </tr>
          <tr>
            <th align="right">Shirt Size :</th>
            <td align="left">
              <select name="shirtSize" id="shirtSize">
                <option value="S">S</option>
                <option value="M">M</option>
                <option value="L">L</option>
                <option value="XL">XL</option>
              </select>
            </td>
          </tr>
          <tr>
            <th align="right">Hat Size :</th>
            <td align="left">
              <select name="hatSize" id="hatSize">
                <option value="S">S</option>
                <option value="M">M</option>
                <option value="L">L</option>
                <option value="XL">XL</option>
              </select>
            </td>
          </tr>
          <tr>
            <th align="right">Shoe Size :</th>
            <td align="left">
              <select name="shoeSize" id="shoeSize">
                <option value="S">S</option>
                <option value="M">M</option>
                <option value="L">L</option>
                <option value="XL">XL</option>
              </select>
            </td>
          </tr>
          <tr>
            <td align="center" colspan="2">
              <input type="submit" value="submit" />
              <input type="reset" value="reset" />
              <br />
          </td>
        </tr>
      </table>
    </form>
  </div>
</body>
</html>

data capture page(this would actually be a servlet that does more with it.
Code:
<?xml version = "1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html>
  <head>
    <title>MISC</title>
  </head>
  <body>
    <fieldset>
      userName1 : <%= request.getParameter("userName1") %>
      <br />
      leggingSize : <%= request.getParameter("leggingSize") %>
      <br />
      shirtSize : <%= request.getParameter("shirtSize") %>
      <br />
      hatSize : <%= request.getParameter("hatSize") %>
      <br />
      shoeSize : <%= request.getParameter("shoeSize") %>
      <br />
      <button value="back" onclick="history.back(1)">back</button>
    </fieldset>
  </body>
</html>

and that's it. very simple, yet doesn't work at all in IE.

...argh again.

Please if there is something stupid that i'm doing/not doing please let me know.

Thanks for all you help on this.

Michael
 
get this.

if i move the two files to a new <context> and remove the JAVA code at the top it works. but just removing the JAVA code and leaving in the current <context> it does not work. doesn't matter how simple the page is, it just won't populate form data under this context.

I'll have to play around in there for a while and see what's going on.

Thanks again.
Michael
 
I have no idea whats going on ... I ahve again put those two pages on my server, with just the SQL bits taken out, and it all works fine :


I would go back to the start and start with a really simple page, and build up.

page1.jsp :

Code:
<%
// all of the raw Java code works
//String userName = NADFC.NTLM.getNTuser(response, request);
//NADFC.DB.NADFCdb mydb = new NADFC.DB.NADFCdb();
//String sqlSELECT = "SELECT Dress_Pant_Size, Shirt_Size, Hat_Size, Shoe_Size FROM t_Sizes WHERE UserName LIKE '" + userName + "'";
//String results[][] = mydb.executeSELECT(sqlSELECT);
String userName = "hardcoded";
%>

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html>
<head>
  <title>NADFC</title>
  <link rel="stylesheet" type="text/css" href="/NADFC/CSS/global.css" />
</head>
<body>
  <div align="center">
      <form name="sizes" id="sizes" action="page2.jsp" method="post">  <!-- to JSP page -->
        <table border="0">
          <tr>
            <th align="right">Name :</th>
            <td align="left">
              <input type="hidden" name="userName1" id="userName1" value="<%= userName %>" />
              <input type="text" name="userName2" id="userName2" value="<%= userName %>" disabled="disabled" />
            </td>
          </tr>
          <tr>
            <th align="right">Dress/Pant Size :</th>
            <td align="left">
              <select name="leggingSize" id="leggingSize">
                <option value="S">S</option>
                <option value="M">M</option>
                <option value="L">L</option>
                <option value="XL">XL</option>
              </select>
            </td>
          </tr>
          <tr>
            <th align="right">Shirt Size :</th>
            <td align="left">
              <select name="shirtSize" id="shirtSize">
                <option value="S">S</option>
                <option value="M">M</option>
                <option value="L">L</option>
                <option value="XL">XL</option>
              </select>
            </td>
          </tr>
          <tr>
            <th align="right">Hat Size :</th>
            <td align="left">
              <select name="hatSize" id="hatSize">
                <option value="S">S</option>
                <option value="M">M</option>
                <option value="L">L</option>
                <option value="XL">XL</option>
              </select>
            </td>
          </tr>
          <tr>
            <th align="right">Shoe Size :</th>
            <td align="left">
              <select name="shoeSize" id="shoeSize">
                <option value="S">S</option>
                <option value="M">M</option>
                <option value="L">L</option>
                <option value="XL">XL</option>
              </select>
            </td>
          </tr>
          <tr>
            <td align="center" colspan="2">
              <input type="submit" value="submit" />
              <input type="reset" value="reset" />
              <br />
          </td>
        </tr>
      </table>
    </form>
  </div>
</body>
</html>

page2.jsp

Code:
<?xml version = "1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html>
  <head>
    <title>MISC</title>
  </head>
  <body>
    <fieldset>
      userName1 : <%= request.getParameter("userName1") %>
      <br />
      leggingSize : <%= request.getParameter("leggingSize") %>
      <br />
      shirtSize : <%= request.getParameter("shirtSize") %>
      <br />
      hatSize : <%= request.getParameter("hatSize") %>
      <br />
      shoeSize : <%= request.getParameter("shoeSize") %>
      <br />
      <button value="back" onclick="history.back(1)">back</button>
    </fieldset>
  </body>
</html>

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
From your previous post, sounds like you've knackered something with the Tomcat config.

My advice would be :

Start off with a simple form.
Do a fresh install of Tomcat.
Put the simple form in the ROOT context, and test.
If OK, move to another context, and test again.
If OK, build on up ...

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
ya. the only thing i can figure is that the context i want to use it in is buggered with some cross-dependencies. i've already started porting things to the new context, and will slowly figure out what i've knackered. Even though everything else in that context works, just not form entry with IE. which is the real kicker here. WHAT IS THE PROBLEM WITH IE????

NEhow, thanks again,
Michael
 
Wow. I'm even more confused now. As it turns out, i've stripped the original context, and slowly rebuilt it, the strange thing is, once it breaks i cannot recover it again. re-starting the service, pulling the class objects, nothing works.

I've drilled down to find out that the IE session is not passing any parameters at all from the FORM back to the server. but again, only in this one folder.

When FireFox POSTs, i can loop through the Parameter Enumerator and display all information i'm looking for, when IE does the same thing, the Enumerator is empty and contains no POST values.

Has anyone seen this before?

Michael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top