Salut !
je tente de faire mon premier Bean utilisable pour le JSF , le voila :
(/WEB-INF/classes/):
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
/*
 * action.java
 *
 * Created on 15 mai 2006, 21:00
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
 
/**
 *
 * @author kedare
 */
public class action {
 
    private long nombre = 500;
 
    public long getNombre()
    {
        return this.nombre;
    }
 
    public void setNombre(long val)
    {
        this.nombre = val;
    }
}
un truc tout bete que j'ai fait pour tester
le probleme c'est qu'au chargement de la page :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
<%@ page contentType="text/html" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="html" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="core" %>
<core:view>
<html:outputText value="#{action.getNombre}" />
 
</core:view>
j'ai le droit a une erreur :
javax.servlet.ServletException: javax.servlet.jsp.JspException: Error getting property 'getNombre' from bean of type action
Voila le fichier de config faces :
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"?>
<!--
Copyright 2003 Sun Microsystems, Inc. All rights reserved.
SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
-->
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-config>
    <application>
        <locale-config>
            <default-locale>fr</default-locale>
        </locale-config>
    </application>
 
    <managed-bean>
        <managed-bean-name>action</managed-bean-name>
        <managed-bean-class>action</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
 
</faces-config>
je ne vois pas ou l'ai fait d'erreur :/
je fait ce tutos : ftp://ftp-developpez.com/schmitt/tut...troduction.pdf