Friday, April 1, 2016

How to escape the af:inputText component value in ADF managed bean

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.

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());

No comments:

Post a Comment