How to URL encode JSF outputLink value
I've got some code that looks similar to this:
<h:outputLink value="#{bean.url}" />
But the output contains an apostrophe in the link href which is not URL encoded.
Am I doing something wrong or is this normal behaviour for outputLin开发者_StackOverflowk? Thanks in advance.
(JBoss 4.2, Java 1.6)
It indeed won't do that for you. It will at highest append the jsessionid
for the case the client doesn't support cookies. Only the link parameters which are added using <f:param>
will be URL-encoded.
<h:outputLink value="#{bean.url}">Click
<f:param name="param1" value="#{bean.urlParam1}" />
<f:param name="param2" value="#{bean.urlParam2}" />
</h:outputLink>
精彩评论