开发者

Problem reading data from servlet get request!

开发者 https://www.devze.com 2023-02-16 11:59 出处:网络
I have a servlet get request URL like this http://hostname:port/servletname?UA=PC#token=123456 How to read values thats available after #tok开发者_运维问答en?

I have a servlet get request URL like this

http://hostname:port/servletname?UA=PC#token=123456

How to read values thats available after #tok开发者_运维问答en?

request.getParameter(#token) gives null..

Any help would be appreciated

Thanks, Krishnan


That's because #token isn't a parameter, it's an HTML page anchor reference. In fact, the browser never even sends it to the server, it's kept entirely on the browser.

If you need to pass the token to the server, you need to encode it as a parameter, i.e.

http://hostname:port/servletname?UA=PC&token=123456


could you try request.getQueryString() ?

0

精彩评论

暂无评论...
验证码 换一张
取 消