Bonjour,
J'ai implémenté dans mon application la fonctionnalité de PrimeFaces Push - FaceMessages (démo) afin d'afficher des notifications aux utilisateurs connectés.
Le tout fonctionne correctement à l'exception de l'encodage des caractères affiché dans le composant <p:growl/>.
Tous les caractères accentués sont remplacé par un "?"
Mes projet sont bien configurés en UTF-8 dans netbeans ainsi que dans les pages JSF d’où mon incompréhension vis-à-vis de ce problème.
Auriez-vous une solution à ce problème ?
Je vous remercie d'avance pour l'aide apportée![]()
J'utilise glassfish 3.1.2.2, Primefaces 3.5, Netbeans, Maven.
web.xml
glassfish-web.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 <?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <session-config> <session-timeout>30</session-timeout> </session-config> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>Push Servlet</servlet-name> <servlet-class>org.primefaces.push.PushServlet</servlet-class> <async-supported>true</async-supported> </servlet> <servlet-mapping> <servlet-name>Push Servlet</servlet-name> <url-pattern>/primepush/*</url-pattern> </servlet-mapping> </web-app>
JSF
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd"> <glassfish-web-app error-url=""> <parameter-encoding default-charset="UTF-8"/> <class-loader delegate="true"/> <jsp-config> <property name="keepgenerated" value="true"> <description>Keep a copy of the generated servlet class' java code.</description> </property> </jsp-config> </glassfish-web-app>
Notification.java
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 <?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:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"> <h:head> ... </h:head> <script type="text/javascript"> function handleMessage(facesmessage) { facesmessage.severity = 'info'; growl.show([facesmessage]); } </script> <f:view locale="#{language.locale}"> <h:body> <div id="global"> <p:growl widgetVar="growl" showDetail="true"/> <p:socket onMessage="handleMessage" channel="/notification" /> // ... </div> </h:body> </f:view>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 public final class Notification { private Notification() { } public static void send(String summary, String detail) { PushContext pushContext = PushContextFactory.getDefault().getPushContext(); pushContext.push("/notification", new FacesMessage(summary, detail)); } }
Partager