В следующей форме мы пытаемся вернуть вводимые пользователем данные в JSF h:inputText
или PrimeFaces 'p:inputText
.
Странное поведение наблюдается при вводе нелатинских символов (японский, иврит и т. Д.):
При первом запросе мы получаем нераспознанный набор символов, а при втором запросе - правильный результат.
Примеры ввода / вывода (только при первом запуске):
Японский :
вход = 日
выход = æ ¥
Иврит :
вход = א
выход = ×
JSF:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<body>
<h:form>
<h:outputLabel value="Name:"/>
<h:inputText value="#{newTestController.registeredCustomerFirstName}"/>
<h:commandButton value="Continue" action="#{newTestController.RegisteredNewCustomer(actionEvent)}"/>
</h:form>
</body>
</html>
Бэк-бин:
@ManagedBean(name = "newTestController")
@SessionScoped
public class NewTestController {
private String registeredCustomerFirstName;
public String getRegisteredCustomerFirstName() {
return registeredCustomerFirstName;
}
public void setRegisteredCustomerFirstName(String registeredCustomerFirstName) {
this.registeredCustomerFirstName = registeredCustomerFirstName;
}
public void RegisteredNewCustomer(ActionEvent actionEvent) throws Exception {
}
}