This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

request.getParameter is null

 
Paid O'Cuana
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Paid O'Cuana
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic