jQuery in Action, 2nd edition*
The moose likes Servlets and the fly likes Unable to read # in input values in doGet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Unable to read # in input values in doGet " Watch "Unable to read # in input values in doGet " New topic
Author

Unable to read # in input values in doGet

A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979

Hi,

I tried reading a # in the input values and unfortunately it doesnt get picked up..

http://localhost:8080/test/test?test=123#¶m2=67#89

in my doGet method, i tried reading the value as



Result is

123
null

Why cant we read the # in the value?

Regards



Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
That is because # is a special character for html anchors.


JDBCSupport - An easy to use, light-weight JDBC framework -
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979


But is there any way i can read the value as is apart from any encoding the char...



Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60072
    
  65

No. Encode the URL properly or it won't work. It's as simple as that.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to read # in input values in doGet
 
Similar Threads
How pass the selected values of the Combo box to the servlet....
form data not passing to servlet file
How pass the selected values of the Combo box to the servlet....
iterating a hashmap
How to refresh a StringBuffer object for creating a HashMap object