Re: bad encoding for f:param value in pretty-config

Splash Forums PrettyFaces Users bad encoding for f:param value in pretty-config Re: bad encoding for f:param value in pretty-config

#20530

xuzhike
Participant

Hi, Christian

thanks for your reply.

I use apache-tomcat-6.0.29 for my project.

I downloaded the latest prettyFaces jar — prettyfaces-jsf2-3.1.1-20101213.211312-54.jar

my testing result as following:

1: java,

@ManagedBean(name = “testView”)

@RequestScoped

public class TestView extends BaseView {

private static final Logger log = Logger.getLogger(TestView.class);

private String query1;

@ManagedProperty(value=”#{param.jsfParam}”)

private String jsfParam;

public String getJsfParam() {

log.info(“TestView.getJsfParam = “+jsfParam);

return jsfParam;

}

public void setJsfParam(String jsfParam) {

log.info(“TestView.setJsfParam = “+jsfParam);

this.jsfParam = jsfParam;

}

public String getQuery1() {

log.info(“TestView.getQuery1 = “+query1);

return query1;

}

public void setQuery1(String query1) {

log.info(“TestView.setQuery1 = “+query1);

this.query1 = query1;

}


test 1


1-1: pretty-config:

<url-mapping id=”fileUpload”>

<pattern>/fileUpload/#{query1:testView.query1}</pattern>

<view-id>/ui/test/fileUpload.xhtml</view-id>

</url-mapping>

1-2: xhtml file:

<pretty:link mappingId=”fileUpload”>

<f:param value=”上传文件” />

上传文件

</pretty:link>

=== test result:

URL: http://localhost:8080/echaoshi/fileUpload/%20%87%F6

log: INFO TestView:42 – TestView.setQuery1 = //no value, strange.



test 2

condition:

just update xhtml file:

<pretty:link mappingId=”fileUpload”>

<f:param value=”上传文件” />

<f:param name=”jsfParam” value=”上传文件”/>

上传文件

</pretty:link>

test result:

Firefox/IE7: http://localhost:8080/echaoshi/fileUpload/%20%87%F6?jsfParam=%E4%B8%8A%E4%BC%A0%E6%96%87%E4%BB%B6

Chrome: seems correct, but if copy/past here, same as IE7.

log:

19:45:21,665 INFO TestView:32 – TestView.setJsfParam = ????????????????????????

19:45:21,665 INFO TestView:42 – TestView.setQuery1 =


test 3

condition update xhtml: user h:link

<h:link outcome=”/ui/test/fileUpload.xhtml” value=”上传文件1″>

<f:param name=”query1″ value=”上传文件”/>

</h:link>

test result:

URL: http://localhost:8080/echaoshi/fileUpload/%20%87%F6

log:

19:51:33,149 INFO TestView:32 – TestView.setJsfParam = null

19:51:33,165 INFO TestView:42 – TestView.setQuery1 =


test 4

xhtml:

<pretty:link mappingId=”fileUpload”>

<f:param value=”上传文件” />

上传文件

</pretty:link>

pretty-config: use query-param

<url-mapping id=”fileUpload”>

<pattern>/fileUpload</pattern>

<view-id>/ui/test/fileUpload.xhtml</view-id>

<query-param name=”query1″> #{testView.query1} </query-param>

</url-mapping>

test result:

URL: http://localhost:8080/echaoshi/fileUpload?query1=%E4%B8%8A%E4%BC%A0%E6%96%87%E4%BB%B6

log:

19:55:40,508 INFO TestView:42 – TestView.setQuery1 = ????????????????????????


conclusion:

seems f:param cannot have non-english charactor?