2

How the best way to handle query strings in Java JSP?

The method request.getQueryString() returns only a strings, how can I get the value of a specific string? Should I parse that string?

thanks

1 Answer 1

8
request.getParameter("param-name");  

if query string is like

id=12&name=abc  

to get name you can do this

request.getParameter("name");  
Sign up to request clarification or add additional context in comments.

4 Comments

could you please tell me how i can instantiate this request object in my bean?
@Shredder request object is created by underlying container , we don't create it.. you can access it from bean depending on the framework. what exact bean you are talking about ?
I'm using jsf 1.1. I have a parts.jsp page with a managed parts.java bean and I'm trying to get the query string in parts.java. This is probably totally different than what this question relates too, i should ask a new question
If you would like to check out my question go here stackoverflow.com/questions/7339397/… :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.