Here is my problem, can someone please help me....!
Present, i am migrating an application from struts to JSF2. We have a user validation link, which sent to their email for verification, after their successful registration. For example:
http://testserv:5050/bjb/page/validateAccount.faces?Email=qwerty@testsession#1.com&Code=1272
The email address contains special characters, in old links which were sent to users. In new application we are encoding them using URLEncoder.encode. i think, this is nothing to do with UTF-8, But however i set request, response, and JSF ExternalContext#setResponseCharacterEncoding to UTF-8. tomcat is also configured for UTF-8.
validateAccount.xhtml
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
</h:head>
<h:body>
<h:form acceptcharset="UTF-8" name="verifyUserAccountForm" id="verifyUserAccountForm" prependId="false">
<f:metadata>
<f:event type="preRenderView" listener="#{verifyUserBean.execute}"></f:event>
</f:metadata>
</h:form>
</h:body>
</html>
In java code, FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(paramName); Could not read the URL GET Request Parameters properly.
How should i solve this for existing links.
I have something in my mind like, i can write a javascript function in my xhtml page,
Which could be excuted on load, so using javascript function i can encode parameters.
But how to execute that javascript function before <f:event type="preRenderView">
call.
is there any better solution ?.