How to get HTTP post parameter in JSP

http-post, jsp

Solution

The `token` attribute looks like a `nonce` to me and some security filter might be removing the value from the request object.

What you have done to print the value is absolutely correct. I am not going for best practices but it should work.

Check your code for security filter and see if you can find out where the value is removed/overridden.

After seeing your web.xml.

The value is passed to the domain using POST. The request is internally redirected to welcome page and the value is lost. If you pass the value using GET the value will be retained.

You have two options:

- Create a direct url and pass the value to it using the post as you are doing. Eg: url - yourdomain.com/welcome.jsp.

- Ask the other project to pass the parameter in the url (GET request).

I have tested both and it works just fine.

Problem

I am new to JSP. I have a jsp page where a parameter is passed to this jsp page with http post. I can see the parameter in firebug as you can see in the picture. But in my page when I try to print the token variable the variable is always null. I print the variable as follows: ``` <% String token = request.getParameter("token"); %> ``` What am I doing wrong? How can I get the token parameter?

Original source

Related problems