This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Servlets and the fly likes getParameter method of Req object Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "getParameter method of Req object" Watch "getParameter method of Req object" New topic
Author

getParameter method of Req object

bhagya patil
Greenhorn

Joined: Oct 14, 2007
Posts: 12
Hi,

In text box i have enter the string &name and in servlet i am
getting its value req.getParamtervalue('textbox name')
when I enter any string iniated with & character i am not
getting the value same case with % character.In logger also
its just not getting the value not even null.

Is there any specific behavior of this method with these characters
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35241
    
    7
You're probably using GET to submit the form, in which case the values will be URL-encoded. You can use the java.net.URLDecoder.decode method to revert the encoding.

I'll move this to the servlet froum, as it has nothing to do with JDBC.


Android appsImageJ pluginsJava web charts
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56191
    
  13

You should not have to do any encoding or decoding on your own. The browser will encode the string when it sends it to the server, and the getParameter() method will decode it.

Or are you sending the string from the browser by some means other than a normal form submission?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
kalyan godavarthy
Greenhorn

Joined: Jan 14, 2008
Posts: 5
Hi
The request object member function is req.getParameter("text box name"), hope you are using this correctly since in your post you used req.getParameterValue(). Try using the printStackTrace from your tomcat logger, and also try using the req.getQueryString() and parse it by your own and see if the value you are typing in the textbox is being received on server or not?
thanks


live and let livE
bhagya patil
Greenhorn

Joined: Oct 14, 2007
Posts: 12
Hi,

Thanks for your reply.

I am not doing any encoding and decoding on my own.
I am submitting and accessing it normally.
As kalyan godavarthy suggested to use getQueryString()
Its working fine.
But with req.getParameterValue("text box name")I am not getting.

Any way.
Thanks once again.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Can you post the relevant parts of your code; both on the server and in your HTML form?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: getParameter method of Req object
 
Similar Threads
code help
Conversion error if input to s:textfield is 0
pulling my hair out
Enetring data in file help!
Validate method not completing