0

How do I represent a query string in jsf?

I have a query string similar to the below.

.../faces/WPages/Nav/Catalog.xhtml?Storeid=1&Categoryid=1005&drilldownproperty1=drilldownpropertyval1&drilldownproperty2=drilldownpropertyval2&drilldownproperty3=drilldownpropertyval3& ...

I would like to represent the params

drilldownproperty1=drilldownpropertyval1&drilldownproperty2=drilldownpropertyval2&drilldownproperty3=drilldownpropertyval3 ...

with something like:

drilldownproperty=drilldownpropertyvals

where drilldownpropertyvals represents drilldownproperty1=drilldownpropertyval1&drilldownproperty2=drilldownpropertyval2&drilldownproperty3=drilldownpropertyval3

How can I encode and decode the string before and after performing the url redirect on my managebean?

1 Answer 1

1

There's the java.net.URLEncoder and java.net.URLDecoder for.

String url = "some.xhtml?drilldownproperty=" + URLEncoder.encode(drilldownpropertyvals, "UTF-8");

And then on the other side

String drilldownpropertyvals = URLDecoder.decode(drilldownproperty, "UTF-8");
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, that is a straightforward solution.

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.