ap:notificationBar にメッセージを書き込むために、primefaces push を使用します。特殊文字 (ロシア文字など) を含むメッセージをプッシュすると、'?' が表示されます。私のメッセージで。この問題を解決するにはどうすればよいですか? ご協力いただきありがとうございます。
(構成:primefaces 3.4およびjsf2。すべてのhtmlページはutf8エンコーディングです)。
これが私のビューコードです:
<p:notificationBar id="bar"
widgetVar="pushNotifBar"
position="bottom"
style="z-index: 3;border: 8px outset #AB1700;width: 97%;background: none repeat scroll 0 0 #CA837D;">
<h:form prependId="false">
<p:commandButton icon="ui-icon-close"
title="#{messages['gen.close']}"
styleClass="ui-notificationbar-close"
type="button"
onclick="pushNotifBar.hide();"/>
</h:form>
<h:panelGrid columns="1" style="width: 100%; text-align: center;">
<h:outputText id="pushNotifSummary" value="#{growlBean.summary}" style="font-size:36px;text-align:center;"/>
<h:outputText id="pushNotifDetail" value="#{growlBean.detail}" style="font-size: 20px; float: left;" />
</h:panelGrid>
</p:notificationBar>
<p:socket onMessage="handleMessage" channel="/notifications"/>
<script type="text/javascript">
function handleMessage(data) {
var substr = data.split(' %% ');
$('#pushNotifSummary').html(substr[0]);
$('#pushNotifDetail').html(substr[1]);
pushNotifBar.show();
}
</script>
と私の Bean コード:
public void send() {
PushContext pushContext = PushContextFactory.getDefault().getPushContext();
String var = summary + " %% " + detail;
pushContext.push("/notifications", var);