File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes POST method parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "POST method parameters" Watch "POST method parameters" New topic

POST method parameters

Shweta Machhe

Joined: Nov 22, 2011
Posts: 8
How can i get the parameters that are submitted In request by POSt method?Is there any way in java to get these values?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15092

If you are programming a servlet, then you can call the getParameter("paramname") method on the ServletRequest object that is passed to the doPost() method of your servlet. In a JSP, there will be an implicit 'request' variable on which you can call getParameter("paramname") on that directly.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Shweta Machhe

Joined: Nov 22, 2011
Posts: 8
I am getting the POST method parameters by request.getparameter(""); method.

But my problem is that, i want to block the password fields in request. I had encrypted these password fields on my submit button click using ajax & again set these encrypted values to form. So that in my form submit action i am getting encrypted values.

But this whole logic fails when i use tools like Selenium automates browsers. This is an Mozilla tool where we can record our browser activities by recording events.
When i start recording browser events in this tool, it captures the form values that are changed, means suppose i have 10 fields on my UI, n i change only 2 of them,one by key type & one by mouse paste. then it directly records these events. So even if i had encrypted these fields after form submit,its of no use.

Please suggest me any solution on it.
Arun Kumar
Ranch Hand

Joined: Oct 10, 2007
Posts: 30
could you post the error/exception for using selenium?
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

Why on earth are you encrypting the field? And in JavaScript? That means that your algorithm is published for all to see and crack.

Just use SSL to protect sensitive data in transit.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: POST method parameters
jQuery in Action, 3rd edition