[Ajax4j][RichFaces] problème d'installation
Bonjour,
je souhaite rajouter le support de ajax4j et RichFaces à un projet JSF + Fcelet
Dans un premier temps je souhaite déjà rajouter ajax4j mais j'ai un problème.
j'ai le fichier web.xml suivant
Code:
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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_2_5.xsd">
<!--
CONFIGURATION DE JSF
-->
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<!--
CONFIGURATION DE FACELETS
-->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<!--
CONFIGURATION DE AJAX4J-JSF
-->
<context-param>
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
<param-value>false</param-value>
</context-param>
<filter>
<display-name>Ajax4jsf Filter</display-name>
<filter-name>ajax4jsf</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<context-param>
<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
<param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>
<filter-mapping>
<filter-name>ajax4jsf</filter-name>
<servlet-name>FacesServlet</servlet-name>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--
WELCOME WEB GLOBALE
-->
<welcome-file-list>
<welcome-file>forward.jsp</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app> |
et le fichier xhtml suivant :
Code:
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 29 30 31 32 33 34 35 36 37 38 39 40
| <?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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j">
<body>
This text above will not be displayed.
<ui:composition template="/template.xhtml">
This text will not be displayed.
<ui:define name="title">
<h:form>
Name :<h:inputText value="#{Secret.name}">
<a4j:support event="onkeyup" reRender="rep"/>
</h:inputText>
Password :<h:inputSecret value="#{Secret.password}" /><br />
<h:commandButton action="#{Secret.valider}" value="valider" />
</h:form>
Facelets
<h1 id="rep"></h1>
</ui:define>
This text will also not be displayed.
<ui:define name="body">
Hello from the Facelets client template!
</ui:define>
This text will not be displayed.
</ui:composition>
This text below will also not be displayed.
</body>
</html> |
Malheureusement quand j'ouvre ma page interne j'obtient le code suivant :
Code:
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 29 30 31 32 33 34
| <?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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Facelets - Template Example</title>
<link href="./css/default.css" rel="stylesheet" type="text/css" />
</head>
<body class="toto">
<h1>
<form id="j_id55" name="j_id55" method="post" action="/pimty/template-client.html" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_id55" value="j_id55" />
Name :
<a4j:support event="onkeyup" reRender="rep">
</a4j:support><input type="text" name="j_id55:j_id57" value="dsqsqdqdsqdqsdq" />
Password :<input type="password" name="j_id55:j_id60" value="" /><br /><input type="submit" name="j_id55:j_id62" value="valider" />
<h1><span id="j_id55:rep">dsqsqdqdsqdqsdq</span></h1><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id1:j_id1" />
</form>
Facelets
</h1>
<p>
Hello from the Facelets client template!
</p><script language="javascript" type="text/javascript">
//<![CDATA[
function faceletsDebug(URL) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = 240,top = 212');"); };var faceletsOrigKeyup = document.onkeyup; document.onkeyup = function(e) { if (window.event) e = window.event; if (String.fromCharCode(e.keyCode) == 'J' & e.shiftKey & e.ctrlKey) faceletsDebug('/pimty/template-client.html?facelets.ui.DebugOutput=1238269833718'); else if (faceletsOrigKeyup) faceletsOrigKeyup(e); };
//]]>
</script>
</body>
</html> |
Comme nous pouvons le voir les balises aj4j ne sont pas interprêté. Pourquoi ?