Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 outputLink? Thanks in advance.

(JBoss 4.2, Java 1.6)

like image 897
rich Avatar asked Sep 09 '10 16:09

rich


1 Answers

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>
like image 85
BalusC Avatar answered Nov 04 '22 16:11

BalusC