如何在jsf中表示查询字符串?
我有一个类似于下面的查询字符串。
... /面/ WPages /导航/ Catalog.xhtml STOREID = 1&安培; CATEGORYID = 1005&安培; drilldownproperty1 = drilldownpropertyval1&安培; drilldownproperty2 = drilldownpropertyval2&安培; drilldownproperty3 = drilldownpropertyval3&安培; ...
我想代表参数
drilldownproperty1=drilldownpropertyval1&drilldownproperty2=drilldownpropertyval2&drilldownproperty3=drilldownpropertyval3 ...
有类似的东西:
drilldownproperty=drilldownpropertyvals
其中drilldownpropertyvals
代表drilldownproperty1=drilldownpropertyval1&drilldownproperty2=drilldownpropertyval2&drilldownproperty3=drilldownpropertyval3
如何在我的managebean上执行url重定向之前和之后对字符串进行编码和解码?
答案 0 :(得分:1)
java.net.URLEncoder
和java.net.URLDecoder
for。
String url = "some.xhtml?drilldownproperty=" + URLEncoder.encode(drilldownpropertyvals, "UTF-8");
然后在另一边
String drilldownpropertyvals = URLDecoder.decode(drilldownproperty, "UTF-8");