[JSF-JPA-JOnAS 5.1 RC3] #{..} is not allowed in template text
Bonjour,
J'aurai besoin d'aide pour résoudre un problème quand je tente d'afficher le contenu d'une instance d'EJB entité que j'ai préalablement instancié dans le faces-config.xml :
L'entité :
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
|
package entities;
import java.io.Serializable;
import javax.persistence.*;
import java.util.List;
/**
* The persistent class for the client database table.
*
*/
@Entity
@Table(name="client")
public class Client implements Serializable {
private static final long serialVersionUID = 1L;
private int idclient;
private String nom;
private List<Contrat> contrats;
public Client() {
}
@Id
@GeneratedValue(strategy=GenerationType.TABLE)
public int getIdclient() {
return this.idclient;
}
public void setIdclient(int idclient) {
this.idclient = idclient;
}
public String getNom() {
return this.nom;
}
public void setNom(String nom) {
this.nom = nom;
}
//bi-directional many-to-one association to Contrat
@OneToMany(mappedBy="client")
public List<Contrat> getContrats() {
return this.contrats;
}
public void setContrats(List<Contrat> contrats) {
this.contrats = contrats;
}
} |
Le faces-config.xml :
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
|
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
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-facesconfig_1_2.xsd"
version="1.2">
<managed-bean>
<managed-bean-name>client</managed-bean-name>
<managed-bean-class>entities.Client</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>idclient</property-name>
<property-class>int</property-class>
<value>1</value>
</managed-property>
<managed-property>
<property-name>nom</property-name>
<property-class>java.lang.String</property-class>
<value>MonNom</value>
</managed-property>
</managed-bean>
</faces-config> |
J'utilise donc un serveur JOnAS 5.1 RC3 et lors de l'exécution de ma JSF toute simple :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
<f:view>
<h:form>
<h:outputText value="#{client.nom}" />
</h:form>
</f:view>
</body>
</html> |
j'obtiens le message d'erreur 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
|
2009-07-24 10:45:46,642 : StandardWrapperValve.invoke : Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /Bonjour.jsp(13,23) #{..} is not allowed in template text
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:102)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:713)
at org.apache.jasper.compiler.Node$ELExpression.accept(Node.java:940)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2399)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
at org.apache.jasper.compiler.Validator.validate(Validator.java:1739)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:166)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.ow2.jonas.web.tomcat6.CheckOpenResourcesValve.invoke(CheckOpenResourcesValve.java:73)
at org.ow2.jonas.web.tomcat6.tx.TransactionValve.invoke(TransactionValve.java:90)
at org.ow2.jonas.web.tomcat6.ResetAuthenticationValve.invoke(ResetAuthenticationValve.java:95)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.ow2.jonas.web.tomcat6.versioning.CoyoteAdapterWithDelegatedContextSearch.service(CoyoteAdapterWithDelegatedContextSearch.java:300)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619) |
Pour information j'ai intégré la librairie JSF 1.2 contenant les jars :
C:\eclipse_2\userLib\myfaces-core-1.2.7-bin\lib\commons-beanutils-1.7.0.jar
C:\eclipse_2\userLib\myfaces-core-1.2.7-bin\lib\commons-codec-1.3.jar
C:\eclipse_2\userLib\myfaces-core-1.2.7-bin\lib\commons-collections-3.2.jar
C:\eclipse_2\userLib\myfaces-core-1.2.7-bin\lib\commons-digester-1.8.jar
C:\eclipse_2\userLib\myfaces-core-1.2.7-bin\lib\commons-discovery-0.4.jar
C:\eclipse_2\userLib\myfaces-core-1.2.7-bin\lib\commons-logging-1.1.1.jar
C:\eclipse_2\userLib\myfaces-core-1.2.7-bin\lib\myfaces-api-1.2.7.jar
C:\eclipse_2\userLib\myfaces-core-1.2.7-bin\lib\myfaces-impl-1.2.7.jar
Après plusieurs heures de recherche, je n'ai vu aucune solution viable dans mon cas donc merci d'avance pour vos prochaines réponses.