Salut à tous,

j'ai écrit mon propre composant et je rencontre un problème de type
JasperException: Unable to convert string "Hello world" to class "javax.el.ValueExpression" for attribute "value"...

mon composant n'a rien de spécial il affiche comme un outputText ce qu'on donne comme valeur à l'attribut value, voici comment j'appel mon composant sur ma page jsf :

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
 
 
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="my" uri="http://mycomponents.org/taglib"%>
 
   <f:view>
       <html>
           <body>
 
               <my:Abstract value="Hello world"/>
 
           </body>
       </html>
   </f:view>
voici la classe de tag associée :

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
 
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import javax.faces.webapp.UIComponentELTag;
 
public class AbstractTag extends UIComponentELTag {
 
    public static final String COMP_TYPE = "component.widgets.UIAbstract";
    public static final String RENDER_TYPE = "component.widgets.AbstractRenderer";
 
    private ValueExpression value = null;
    private ValueExpression styleClass = null;
    private ValueExpression style = null;
 
    public String getComponentType() {
        return COMP_TYPE;
    }
 
    public String getRendererType() {
        return RENDER_TYPE;
    }
 
    protected void setProperties(UIComponent component) {
        super.setProperties(component);
        component.setValueExpression("value",value);
        component.setValueExpression("styleClass",styleClass);
        component.setValueExpression("style",style);
    }
 
    public void release() {
        super.release();
        value = null;
        styleClass = null;
        style = null;
    }
 
    public void setValue(ValueExpression value) {
        this.value = value;
    }
 
    public void setStyleClass(ValueExpression styleClass) {
        this.styleClass = styleClass;
    }
 
    public void setStyle(ValueExpression style) {
        this.style = style;
    }
 
}
voici la classe du composant :

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
 
 
import javax.faces.component.UIOutput;
 
public class UIAbstract extends UIOutput {
 
    public static final String FAMILIY = "javax.faces.Output";
 
    public UIAbstract() {
        super();
        setRendererType("component.widgets.AbstractRenderer");
    }
 
    public String getFamily() {
        return FAMILIY;
    }
 
}
voici le renderer associé :

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 
 
import java.io.IOException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.render.Renderer;
 
public class AbstractRenderer extends Renderer {
 
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
 
        ResponseWriter writer = context.getResponseWriter();
        String clientId = component.getClientId(context);
        UIAbstract abstractComp = (UIAbstract) component;
 
        writer.startElement("div", abstractComp);
 
        String styleclass = (String) abstractComp.getAttributes().get("styleClass");
        if (styleclass != null)
            writer.writeAttribute("class",styleclass,"styleclass");
 
        String style = (String) abstractComp.getAttributes().get("style");
        if (style != null)
            writer.writeAttribute("style",style,"style");
 
        writer.startElement("h3", abstractComp);
 
        String value = (String) abstractComp.getAttributes().get("value");
        if (value != null)
                writer.write(value);
 
        writer.flush();
 
    }
 
    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        writer.endElement("h3");
        writer.endElement("div");
        writer.flush();
    }
 
    public void decode(FacesContext context, UIComponent component) {
        return;
    }  
 
}
et voici la taglib :

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
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
 
 
<?xml version="1.0" encoding="UTF-8"?>
<taglib 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-jsptaglibrary_2_1.xsd"
   version="2.1">
 
    <tlib-version>1.1</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>my</short-name>
    <uri>http://mycomponents.org/taglib</uri>
 
    <tag>
        <name>Abstract</name>
        <tag-class>component.widgets.AbstractTag</tag-class>
        <body-content>JSP</body-content>
 
        <attribute>
            <name>id</name>
            <required>false</required>
            <rtexprvalue>false</rtexprvalue>
        </attribute>
 
        <attribute>
            <name>binding</name>
        </attribute>
 
        <attribute>
            <name>rendered</name>
            <required>false</required>
            <rtexprvalue>false</rtexprvalue>
        </attribute>
 
        <attribute>
            <name>value</name>
            <required>false</required>
            <rtexprvalue>false</rtexprvalue>
        </attribute>
 
        <attribute>
            <name>styleClass</name>
            <required>false</required>
            <rtexprvalue>false</rtexprvalue>
        </attribute>
 
        <attribute>
            <name>style</name>
            <required>false</required>
            <rtexprvalue>false</rtexprvalue>
        </attribute>
    </tag>
</taglib>
tout est bien reconnu avec jsf1.2 mais le seul problème c'est que dès que je spécifie un attribut dans ma balise <my:Abstract value="toto" ou bien style="position:relative" ou encore styleClass=... /> j'obtiens une exception dont voici le détail :

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
 
org.apache.jasper.JasperException: Unable to convert string "Hello world" to class "javax.el.ValueExpression" for attribute "value": Property Editor not registered with the PropertyEditorManager
	org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:887)
	org.apache.jsp.mapfaces_jsp._jspx_meth_mf_005fAbstract_005f0(mapfaces_jsp.java:179)
	org.apache.jsp.mapfaces_jsp._jspx_meth_f_005fview_005f0(mapfaces_jsp.java:123)
	org.apache.jsp.mapfaces_jsp._jspService(mapfaces_jsp.java:77)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:415)
	com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:475)
	com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:143)
	com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
	com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
	com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)

voila si qq1 a rencontrer ce genre d'exception merci de m'aider