| Author |
request.getParameter is null
|
Paid O'Cuana
Greenhorn
Joined: Mar 05, 2003
Posts: 24
|
|
Hi, I've transferred a website from a test server to a live one, which seemingly has the exact same set up, but I have one problem. Whenever a parameter is sent in a URL, e.g. www.website.com/script.jsp?action=enter the action parameter isn't picked up. This String szAction = null; szAction = request.getParameter("action"); System.out.println("Action is "+szAction); results in "Action is null". It's the same throughout the site since I moved it over. Running on Apache with mod_jk to tomcat 3.2.3 Any idea what the problem could be?
|
 |
Alex Kravets
Ranch Hand
Joined: Jan 24, 2001
Posts: 476
|
|
I had the same problem. We used to run our applications on eWave web server and then moved to JBoss. All of a sudden some applications did not pick up parameters from URL. A workraround that worked for me was putting URL encoded fields into hidden form fields in the page: I am not sure why I encountered this problem when moving to JBoss...
|
All right brain, you don't like me and I don't like you, but let's just do this one thing so I can get back to killing you with beer.<br /> <br />- Homer Simpson
|
 |
Paid O'Cuana
Greenhorn
Joined: Mar 05, 2003
Posts: 24
|
|
Thanks, but it's a fairly big app and that would take a long time. Plus, there must be a more satisfactory solution, you have to be able to do URL encoding. Do you know what causes it? Could I be missing a library of some sort?/
|
 |
Alex Kravets
Ranch Hand
Joined: Jan 24, 2001
Posts: 476
|
|
try this, in script.jsp just write: Replacing 'action' with 'command'. In one application I did, I would get error when I passed parameter called delete, once I renamed it to deleteRecord everything worked fine.
|
 |
Paid O'Cuana
Greenhorn
Joined: Mar 05, 2003
Posts: 24
|
|
Ok I've set up a test for this on two different servers. Click on the link that appears to view the output. Server A Test and Server B Test It works on Server B, but breaks down on Server A. You'll notice that request.getParameter gets the correct values from the URL in Server B, but it's null in Server A. However, request.getQueryString() returns the proper query string in both examples. Here's the source code used: I've done a Tomcat re-install, hoping that might solve my problems, but got the same error. Has anyone encountered this problem before? [ June 14, 2004: Message edited by: Paid O'Cuana ] [ June 14, 2004: Message edited by: Paid O'Cuana ]
|
 |
Sonny Gill
Ranch Hand
Joined: Feb 02, 2002
Posts: 1211
|
|
yup, some of my colleagues had that or a similar problem. They just used hidden fields or something as a work around, which as you said is not very satisfactory.
|
 |
 |
|
|
subject: request.getParameter is null
|
|
|