开发者

POST data sent by Spring MVC is null on IE8

开发者 https://www.devze.com 2023-02-23 08:06 出处:网络
I have two text fields (pageField1) and pageField2) in Spring MVC where an user can input in page numbers. The javascript code retrieves the values in these textfields and sends as POST data to the co

I have two text fields (pageField1) and pageField2) in Spring MVC where an user can input in page numbers. The javascript code retrieves the values in these textfields and sends as POST data to the controller. The code for retreiving the values and sending as POST data in javascript is exactly the same for both fields.

In th开发者_Go百科e Controller, I use request.getParameter("value") to retrieve the POST data. On Firefox and Chrome, values for both pageField1 and pageField2 are retrieved fine. On IE8, request.getParameter("value") returns null for pageField1 but the correct value for pageField2.

This is really baffling, and I am stumped. I put an alert just before Spring MVC sends the POST data to the controller. The values are exactly the same for FireFox and IE, but when retrieved on the controller, its null on IE.

Any input would be great! I can post snippet of the code if needed.

Thanks!


Will try using HTTPtea. I already downloaded it, just have to configure it now. Thanks!! Here is my JavaScript code: Here is the JavaScript code:

functionPageField1(event){
    if (event == null || event.keyCode == 13) {
      var domain = document.getElementById('domainTextField').value;
      var nameToFindExcl = document.getElementById('searchObjectsExclTextField').value;
      var pageNumberExcl = document.getElementById('pageNumberExclTextField').value;
      var pageCountExcl = document.getElementById('pageCountExclTextField').value;
      var nameToFindIncl = document.getElementById('searchObjectsInclTextField').value;
      var pageNumberIncl = document.getElementById('pageNumberInclTextField').value;
      if (!isValidInput(pageNumberExcl,pageNumberIncl)){
        return;
      }

      alert("/sysmgr/domains/viewDomainObjects.spr?domain=" + domain + "&nameToFindExcl=" + nameToFindExcl +
        "&pageNumberExcl=" + pageNumberExcl + "&nameToFindIncl=" + nameToFindIncl + "&pageNumberIncl=" + pageNumberIncl);

      /* Its the pageNumberExcl that is null in the controller, where as all other 
         values are fine.
         In the above alert, I see the correct value for pageNumberExcl, but its null when I retreive it in the controller. 
      */
      window.location="/sysmgr/domains/viewDomainObjects.spr?domain=" + domain + "&nameToFindExcl=" + nameToFindExcl +
        "&pageNumberExcl=" + pageNumberExcl + "&nameToFindIncl=" + nameToFindIncl + "&pageNumberIncl=" + pageNumberIncl;
    }
  }

 //This is the snippet of the html code that defines the pageNumberExcl Field
 <td>
            <p align="right">
              <fmt:message key="form.any.page"/> <input type="text" id="pageNumberExclTextField"
                value="${pageNumberExcl}" size="3" onKeyPress="numberPageExcl(event)">
              <fmt:message key="form.any.of"/> <input disabled type="text" style="border-style:none; background-color:white; color:black"
                id="pageCountExclTextField" value="${pageCountExcl}" size="3">
            </p>
 </td>`
0

精彩评论

暂无评论...
验证码 换一张
取 消