| Author |
Request.getParameter() coming as Null in IE
|
Nick Smit
Greenhorn
Joined: Feb 08, 2011
Posts: 19
|
|
Using Struts 1.3
My code
In JSP setting hidden fields like this
-------------
<input type="hidden" name="myStatus"/>
-------------
Setting values and Submitting form in JS
-------------
document.getElementsByName("myStatus")[0].value = 10;
document.forms[0].action = "/corporate/user/viewSheet";
document.forms[0].submit();
-------------
Retrieving in Action
-------------
System.out.println(request.getParameter("myStatus"));
-------------
I am getting proper value in Chrome and Firefox but in IE this comes as Null
Anybody has a solution?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56233
|
|
|
The hidden input has no value.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Nick Smit
Greenhorn
Joined: Feb 08, 2011
Posts: 19
|
|
|
I am setting it in javascript. That is what I am trying to retrieve in action.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56233
|
|
|
Is the JavaScript boofing up in IE?
|
 |
Nick Smit
Greenhorn
Joined: Feb 08, 2011
Posts: 19
|
|
|
I have checked it goes and sets it properly in javascript but when it comes in action, it gives me null. remember its working perfectly in other browsers.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56233
|
|
|
How have you checked it? The JavaScript failing is the most obvious problem point.
|
 |
Nick Smit
Greenhorn
Joined: Feb 08, 2011
Posts: 19
|
|
|
I have put alert after setting value. It is coming fine.
|
 |
Sergey Baranov
Greenhorn
Joined: Aug 27, 2005
Posts: 18
|
|
|
What version of IE?
|
Sergey Baranov
|
 |
Nick Smit
Greenhorn
Joined: Feb 08, 2011
Posts: 19
|
|
|
IE 8
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56233
|
|
|
At this point I think you need to post a SSCCE.
|
 |
Nick Smit
Greenhorn
Joined: Feb 08, 2011
Posts: 19
|
|
Finally I found what is the issue.
My Hidden field has name "myStatus"
My page is consisting of mutiple JSPs
In other jsp, I had one more input field which has same id "myStatus"
IE was referring to that field so I was not getting value, while other browsers can differentiate between id and name, IE is dumb not to do that. So when I changed the name of my hidden field , it started working...
|
 |
 |
|
|
subject: Request.getParameter() coming as Null in IE
|
|
|