Accéder à un bean lorsque l'on utilise les facelets
Bonjour,
J'ai un serveur glassfish+mysql, et j'utilise netbeans(6.1).
Afin de me simplifier la vie, j'ai décidé d'utiliser des facelets afin de n'avoir qu'un seul design comme template.
J'ai donc créé, de manière très basique ce fichier xhtml:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>TrustBN - #{title}</title>
</head>
<body>
<p>
<ui:define name ="body"/>
</p>
</body>
</html> |
J'ai ensuite créé une page JSP/JSF qui va l'implémenter:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| <?xml version="1.0" encoding="UTF-8"?>
<!--
Document : testfile
Created on : 18 juin 2009, 14:20:02
Author : J4N
-->
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html" version="2.0">
<jsp:directive.page contentType="text/html" pageEncoding="UTF-8"/>
<f:view>
<ui:composition template="/WEB-INF/template.xhtml">
<ui:param name="title" value="toto"/>
<ui:define name="body">
<h:outputText>#{testfile2.toto}</h:outputText>
</ui:define>
</ui:composition>
</f:view>
</jsp:root> |
Tout allait bien jusqu'à ce que j'utilise #{blablabla}, la on me dit:
org.apache.jasper.JasperException: PWC6228: #{...} not allowed in a template text body. en pointant la ligne ou j'ai mon outputText.
J'ai essayé de faire de même sans le template et tout marche impeccable.
Avez vous une idée comment résoudre ce problème?