Sometimes its a requirement that the text entered by the end user has to be escaped and should be stored to not loose the values entered by the end user.
af:inputText id="it3" label="message" binding="#{requestScope.MB.message}" autoSubmit="true" />
How to do it?
This can be done using the StringEscapeUtils Module
JSFF Code
af:inputText id="it3" label="message" binding="#{requestScope.MB.message}" autoSubmit="true" />
Managedbean Code
import org.apache.commons.lang.StringEscapeUtils;
//Use the StringEscapeUtils Module
String userMessage = StringEscapeUtils.escapeHtml((String)message.getValue());
import org.apache.commons.lang.StringEscapeUtils;
//Use the StringEscapeUtils Module
String userMessage = StringEscapeUtils.escapeHtml((String)message.getValue());
No comments:
Post a Comment