我正在使用JSF 2.1和primefaces 5.3.8在JBoss EAP 6.4.4.GA(AS 7.5.4.Final-redhat-4)上工作。JBOSS EAP德语变音编码破解
由于部署了我的应用程序的lates版本,在我的表单中出现了元音变音编码的问题。
<p:inputText widgetVar="vornameVar" id="vornameInput" value="#{empfaengerBean.vorname}">
</p:inputText>
我首先想到的是,有在新版本中的错误。但不幸的是,我没有发现。此外,如果我恢复到旧版本(以前运行良好),错误也会突然发生。
我试图按照JSF Form and German Umlauts中描述的方法解决问题,但没有成功。
我添加文件的编码系统属性:
file.encoding = UTF-8
file.encoding.pkg = sun.io
sun.jnu.encoding = UTF-8
sun.io.unicode.encoding = UnicodeLittle
而在XHTML形式的字符集。
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
而且我加了CharachterEncodingFilter:
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
遗憾的是它并没有reslove错误。
请求报头:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, br
Accept-Language:de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Cache-Control:no-cache
Connection:keep-alive
Content-Length:942
Content-Type:application/x-www-form-urlencoded
Cookie:JSESSIONID=FS0R99ApjnD0M667rZaNcwVT
Host:localhost:8080
Origin:http://localhost:8080
Pragma:no-cache
Referer:http://localhost:8080/faces/myform.xhtml?dswid=559
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
响应头: 的Content-Type:text/html的;字符集= UTF-8 日期:星期三,2017年5月17日7时37分十七秒GMT 服务器:Apache- Coyote/1.1 传输编码:分块 X-UA兼容:IE = 8; IE =边缘
表单数据:
layout:inhalt:empfaengerMask:vornameInput:ÖÄÖ
layout:inhalt:empfaengerMask:familiennameInput:öäö
layout:inhalt:empfaengerMask:geburtsdarumInput:
layout:inhalt:empfaengerMask:j_idt39_collapsed:false
layout:inhalt:empfaengerMask:saveAndBackButton:
javax.faces.ViewState:8922152724142018356:3520638725638532662
dspwid:559
响应:
<?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">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<form id="layout:inhalt:empfaengerMask"
name="layout:inhalt:empfaengerMask" method="post"
action="/faces/myform.xhtml?dswid=559"
enctype="application/x-www-form-urlencoded">
<input type="hidden" name="layout:inhalt:empfaengerMask"
value="layout:inhalt:empfaengerMask" />
<table style="display: inline-block; float: left; text-align: left;">
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td><label id="layout:inhalt:empfaengerMask:j_idt67"
class="ui-outputlabel"
for="layout:inhalt:empfaengerMask:vornameInput">Vorname</label></td>
<td><input id="layout:inhalt:empfaengerMask:vornameInput"
name="layout:inhalt:empfaengerMask:vornameInput" type="text"
value="ÃÃÃ" maxlength="80" /></td>
<td><label id="layout:inhalt:empfaengerMask:j_idt70"
class="ui-outputlabel"
for="layout:inhalt:empfaengerMask:familiennameInput">Familienname</label></td>
<td><input id="layout:inhalt:empfaengerMask:familiennameInput"
name="layout:inhalt:empfaengerMask:familiennameInput" type="text"
value="öäö" maxlength="80"
class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" /></td>
</tr>
<tr>
<td><label id="layout:inhalt:empfaengerMask:j_idt73"
class="ui-outputlabel"
for="layout:inhalt:empfaengerMask:geburtsdarumInput">Geburtsdatum</label></td>
<td><input id="layout:inhalt:empfaengerMask:geburtsdarumInput"
name="layout:inhalt:empfaengerMask:geburtsdarumInput" type="text"
class="ui-inputfield ui-inputmask ui-widget ui-state-default ui-corner-all" /></td>
<td></td>
</tbody>
</table>
</td>
</tr>
</table>
</fieldset>
</div>
<input type="hidden"
id="layout:inhalt:empfaengerMask:j_idt39_collapsed"
name="layout:inhalt:empfaengerMask:j_idt39_collapsed" value="false" />
</fieldset>
<script id="layout:inhalt:empfaengerMask:j_idt39_s"
type="text/javascript">PrimeFaces.cw("Fieldset","widget_layout_inhalt_empfaengerMask_j_idt39",{id:"layout:inhalt:empfaengerMask:j_idt39",toggleable:true,collapsed:false,toggleSpeed:500});</script>
<br />
<p></p>
<span id="layout:inhalt:empfaengerMask:detailPanel">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</span></span>
<p></p>
<div id="layout:inhalt:empfaengerMask:aktionleiste"
class="ui-widget-content layout_appaktionsleiste">
<div class="layout_appaktionsleiste_content">
<button id="layout:inhalt:empfaengerMask:j_idt120"
name="layout:inhalt:empfaengerMask:j_idt120"
class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
onclick="PrimeFaces.addSubmitParam('layout:inhalt:empfaengerMask',{'disableValidation':'null'})"
style="float: left" type="submit">
<span class="ui-button-text ui-c">Abbrechen</span>
</button>
<script id="layout:inhalt:empfaengerMask:j_idt120_s"
type="text/javascript">PrimeFaces.cw("CommandButton","widget_layout_inhalt_empfaengerMask_j_idt120",{id:"layout:inhalt:empfaengerMask:j_idt120"});</script>
<button id="layout:inhalt:empfaengerMask:saveAndBackButton"
name="layout:inhalt:empfaengerMask:saveAndBackButton"
class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
onclick="" type="submit">
<span class="ui-button-text ui-c">Speichern und zurück</span>
</button>
<script id="layout:inhalt:empfaengerMask:saveAndBackButton_s"
type="text/javascript">PrimeFaces.cw("CommandButton","saveAndBackButtonVar",{id:"layout:inhalt:empfaengerMask:saveAndBackButton"});</script>
<script id="layout:inhalt:empfaengerMask:j_idt122_s"
type="text/javascript">$(function(){PrimeFaces.cw("DefaultCommand","widget_layout_inhalt_empfaengerMask_j_idt122",{id:"layout:inhalt:empfaengerMask:j_idt122",target:"layout:inhalt:empfaengerMask:saveAndBackButton"});});</script>
</div>
</div>
<div style="clear: both;"></div>
<span id="layout:inhalt:empfaengerMask:wizInit"> <script
type="text/javascript">
var arDialog = null;
mainInitWiz();
</script></span><input type="hidden" name="javax.faces.ViewState"
id="javax.faces.ViewState"
value="8922152724142018356:-5232436045222872752" autocomplete="off" />
</form>
</html>
我dont't知道我错过了那么远。
如果你用'h:inputText'替换'p:inputText',它会工作吗?...和_“如果我恢复到旧版本(以前运行良好),错误突然发生。 _还有什么改变? – Kukeltje
更改为'h:inputText'不能解决问题。我刚刚检查了我的更改。与当前版本相比,后端bean中只有一些次要布局和错误修正。由于另一个问题(http://stackoverflow.com/questions/23375313/http-request-returns-200-ok-but-no-content-in-response)添加了下列系统属性:' –
zoenzbinz