Hi everybody, I submitted a question yesterday, see the mail below, but I didn't get any replies and wonder if my subject-line might have pulled people off the actual question. :)
In short my problem is that I create components (HtmlOutputText) java-side, and set the value with ValueExpressions. But when the page renders, the values displayed are encoded in some format: White-spaces are replaced by '+', @ is replaced by %40 and so on. Anybody knows where I can get some help on this? Would it be "accepted" for me to ask the developers mailing list instead? Best regards, Eivind Rønnevik -----Original Message----- From: Eivind Ronnevik [mailto:[EMAIL PROTECTED] Sent: 13. august 2008 14:18 To: MyFaces Discussion Subject: Encoding error/problem in myfaces 1.2 when using componentBindings and valueExpression Hi, I build up a form with different inputs, and the bean behind it is in session scope. My problem is that after I submit the form, and the view is restored, all the values are displayed with what seems to be UTF-8 encoding. Let's say I have an input-text where the user should enter e-mail address: Before I submit the value is like '[EMAIL PROTECTED]". After submitting and the page is reloaded the value displayed is 'myemail%40myisp.com'. And a String like "Your item was successfully created" becomes "Your+item+was+successfully+created". I've been working with myfaces 1.1 for quite some time, and have never experienced this. I started to dive into the problem, and I believe I can conclude with the following: If you use componentBindings and set the value of that component to a "static" value, it works. But if you use componentBindings AND valueExpression it doesn't. To give a concrete example: A java class Test which is in session scope, holds a property message of type String public class Test { private String message = "My test for encoding issues. Emails are written like [EMAIL PROTECTED] "; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } } If I have a jsp and use an h:outputText directly with a valueExpression, it works - the message comes out just fine: <h:panelGrid id="testPanel"> <h:outputText value="#{test.message}"></h:outputText> </h:panelGrid> But if I create a componentBinding for this outputText instead, AND fill it up with valueExpression, I get the problem: <h:panelGrid id="testPanel"> <h:outputText binding="#{test.htmlOutputText}"></h:outputText> </h:panelGrid> public class Test { public HtmlOutputText getHtmlOutputText() { if(htmlOutputText == null) { htmlOutputText = new HtmlOutputText(); htmlOutputText.setId("testText"); FacesContext context = FacesContext.getCurrentInstance(); ValueExpression vex = context.getApplication().getExpressionFactory().createValueExpression(co ntext.getELContext(), "#{test.message}", String[].class); htmlOutputText.setValueExpression("value", vex); } return htmlOutputText; } } If I use a componentBinding, but set the value directly it the htmlOutputText, it works: public HtmlOutputText getHtmlOutputText() { if(htmlOutputText == null) { htmlOutputText = new HtmlOutputText(); htmlOutputText.setId("testText"); htmlOutputText.setValue("My test for encoding issues. Emails are written like [EMAIL PROTECTED]"); } return htmlOutputText; } Can someone explain this? An hopefully provide a solution as well? :) I use myfaces-1.2.3. In the web.xml I have the following encoding-mapping: <locale-encoding-mapping-list> <locale-encoding-mapping> <locale>en</locale> <encoding>UTF-8</encoding> </locale-encoding-mapping> <locale-encoding-mapping> <locale>no</locale> <encoding>UTF-8</encoding> </locale-encoding-mapping> </locale-encoding-mapping-list> Best regards, Eivind Roennevik

