IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JSF Java Discussion :

probleme coud'nt find facescontext


Sujet :

JSF Java

  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Décembre 2007
    Messages
    150
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2007
    Messages : 150
    Par défaut probleme coud'nt find facescontext
    Bonjour tout le monde, voici mon code, j'ai un probleme que je détails tout en bas, priere d'avoir la patience nécessaire pour m'y aider.

    voici ma page Page1.jsp :

    **********************************
    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
     
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- 
        Document   : Page1
        Created on : 14 juil. 2009, 12:03:03
        Author     : lhabib
    -->
    <jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <f:view>
            <webuijsf:page id="page1">
                <webuijsf:html id="html1">
                    <webuijsf:head id="head1">
                        <webuijsf:link id="link1" url="/resources/stylesheet.css"/>
                    </webuijsf:head>
                    <webuijsf:body id="body1" style="-rave-layout: grid">
                        <webuijsf:form id="form1">
                            <webuijsf:textField binding="#{Page1.textField1}" id="textField1" style="position: absolute; left: 336px; top: 120px"/>
                            <webuijsf:textField binding="#{Page1.textField2}" id="textField2" style="left: 336px; top: 168px; position: absolute"/>
                            <webuijsf:label id="label1" style="left: 216px; top: 120px; position: absolute" text="Nom :"/>
                            <webuijsf:label id="label2" style="position: absolute; left: 216px; top: 168px" text="Mot de passe :"/>
                            <webuijsf:button actionExpression="#{Page1.button1_action}" binding="#{Page1.button1}" id="button1"
                                style="height: 24px; left: 552px; top: 168px; position: absolute; width: 95px" text="Valider"/>
                            <webuijsf:label binding="#{Page1.label3}" id="label3" style="height: 24px; left: 336px; top: 288px; position: absolute; width: 96px"/>
                        </webuijsf:form>
                    </webuijsf:body>
                </webuijsf:html>
            </webuijsf:page>
        </f:view>
    </jsp:root>
    ************************************
    voici Page1.java, le bean associé je crois :

    ********************************
    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
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    package decompte_test;
     
    import com.sun.rave.web.ui.appbase.AbstractPageBean;
    import com.sun.webui.jsf.component.Button;
    import com.sun.webui.jsf.component.Label;
    import com.sun.webui.jsf.component.TextField;
    import java.sql.*;
    import java.sql.SQLException;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.faces.FacesException;
     
     
     
    public class Page1 extends AbstractPageBean {
     
        private void _init() throws Exception {
        }
        private TextField textField1 = new TextField();
     
        public TextField getTextField1() {
            return textField1;
        }
     
        public void setTextField1(TextField tf) {
            this.textField1 = tf;
        }
        private TextField textField2 = new TextField();
     
        public TextField getTextField2() {
            return textField2;
        }
     
        public void setTextField2(TextField tf) {
            this.textField2 = tf;
        }
        private Button button1 = new Button();
     
        public Button getButton1() {
            return button1;
        }
     
        public void setButton1(Button b) {
            this.button1 = b;
        }
        private Label label3 = new Label();
     
        public Label getLabel3() {
            return label3;
        }
     
        public void setLabel3(Label l) {
            this.label3 = l;
        }
     
     
        public Page1() {
        }
     
     
     
        @Override
        public void init() {
     
            super.init();
     
            try {
                _init();
            } catch (Exception e) {
                log("Page1 Initialization Failure", e);
                throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
            }
     
     
        }
     
     
        @Override
        public void preprocess() {
        }
     
     
        @Override
        public void prerender() {
        }
     
     
        @Override
        public void destroy() {
        }
     
     
        protected SessionBean1 getSessionBean1() {
            return (SessionBean1) getBean("SessionBean1");
        }
     
     
        protected RequestBean1 getRequestBean1() {
            return (RequestBean1) getBean("RequestBean1");
        }
     
     
     
        protected ApplicationBean1 getApplicationBean1() {
            return (ApplicationBean1) getBean("ApplicationBean1");
        }
     
        public String button1_action() {
     
            String username = null;
            String password = null;
            String m = null;
            String p = null;
     
            try {
     
                 username = (String) textField1.getText();
                 password = (String) textField2.getText();
                ConnectDB connexion = new ConnectDB();
                connexion.connect("select * from intervenant");
     
                while (connexion.rs.next()) {
                    m = connexion.rs.getString("matricule");
                    p = connexion.rs.getString("password");
                    if (username.equals(m) && password.equals(p))
                        break;
                            }
                    }
     
            catch (SQLException ex) {
                Logger.getLogger(Page1.class.getName()).log(Level.SEVERE, null, ex);
            }
    if (username.equals(m) && password.equals(p))
                    return "case1";
                    return null;
              }
    }
    ***************************************

    mon fichier web.xml :

    ****************************************

    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
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    <?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">
        <context-param>
            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
            <param-value>client</param-value>
        </context-param>
        <context-param>
            <param-name>com.sun.faces.validateXml</param-name>
            <param-value>true</param-value>
        </context-param>
        <context-param>
            <param-name>com.sun.faces.verifyObjects</param-name>
            <param-value>false</param-value>
        </context-param>
        <filter>
            <filter-name>UploadFilter</filter-name>
            <filter-class>com.sun.webui.jsf.util.UploadFilter</filter-class>
            <init-param>
                <description>The maximum allowed upload size in bytes.  If this is set to a negative value, there is no maximum.  The default value is 1000000.</description>
                <param-name>maxSize</param-name>
                <param-value>1000000</param-value>
            </init-param>
            <init-param>
                <description>The size (in bytes) of an uploaded file which, if it is exceeded, will cause the file to be written directly to disk instead of stored in memory.  Files smaller than or equal to this size will be stored in memory.  The default value is 4096.</description>
                <param-name>sizeThreshold</param-name>
                <param-value>4096</param-value>
            </init-param>
        </filter>
        <filter-mapping>
            <filter-name>UploadFilter</filter-name>
            <servlet-name>Faces Servlet</servlet-name>
        </filter-mapping>
        <servlet>
            <servlet-name>Faces Servlet</servlet-name>
            <jsp-file>/Page1.jsp</jsp-file>
            <init-param>
                <param-name>javax.faces.LIFECYCLE_ID</param-name>
                <param-value>com.sun.faces.lifecycle.PARTIAL</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet>
            <servlet-name>ExceptionHandlerServlet</servlet-name>
            <servlet-class>com.sun.errorhandler.ExceptionHandler</servlet-class>
            <init-param>
                <param-name>errorHost</param-name>
                <param-value>localhost</param-value>
            </init-param>
            <init-param>
                <param-name>errorPort</param-name>
                <param-value>24444</param-value>
            </init-param>
        </servlet>
        <servlet>
            <servlet-name>ThemeServlet</servlet-name>
            <servlet-class>com.sun.webui.theme.ThemeServlet</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>/faces/*</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>ExceptionHandlerServlet</servlet-name>
            <url-pattern>/error/ExceptionHandler</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>ThemeServlet</servlet-name>
            <url-pattern>/theme/*</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>Page1.jsp</welcome-file>
            </welcome-file-list>
        <error-page>
            <exception-type>javax.servlet.ServletException</exception-type>
            <location>/error/ExceptionHandler</location>
        </error-page>
        <error-page>
            <exception-type>java.io.IOException</exception-type>
            <location>/error/ExceptionHandler</location>
        </error-page>
        <error-page>
            <exception-type>javax.faces.FacesException</exception-type>
            <location>/error/ExceptionHandler</location>
        </error-page>
        <error-page>
            <exception-type>com.sun.rave.web.ui.appbase.ApplicationException</exception-type>
            <location>/error/ExceptionHandler</location>
        </error-page>
        <jsp-config>
            <jsp-property-group>
                <url-pattern>*.jspf</url-pattern>
                <is-xml>true</is-xml>
            </jsp-property-group>
            </jsp-config>
        </web-app>
    *******************************************

    Je signale que case1 s'affiche pour une authnetification réussie.

    Si le fichier faces-config est aussi nécessaire dites le moi je l'envoie.

    Mon but est de réaliser une authentification avec BD MySQL depuis une JSF.

    Le probleme est que le browser m'affiche une exeption
    " could'nt find facescontext "

    pour l'URL : localhost:8080/decompte_test/faces/Page1.jsf ou decompte_test est le nom du projet.

  2. #2
    Membre éclairé
    Profil pro
    Inscrit en
    Décembre 2002
    Messages
    325
    Détails du profil
    Informations personnelles :
    Localisation : France, Nord (Nord Pas de Calais)

    Informations forums :
    Inscription : Décembre 2002
    Messages : 325
    Par défaut
    C'est normal que nulle part on ne trouve les lignes suivantes ?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    <servlet>
    		<servlet-name>Faces Servlet</servlet-name>
    		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Décembre 2007
    Messages
    150
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2007
    Messages : 150
    Par défaut
    En effet bonne question c'est pas normal.

    Je les ai ajoutés, mais cette fois ci le browser n'affiche que du blanc c'est à dire rien du tout.

    Bref mon but est de réaliser un aller retour vers la BD MySQL pour une authentification, si vous avez du code qui marche svp envoyez le moi à aouani.elhabib@gmail.com.

    Une fois que l'accés a la base de données fonctionnera je pourrais terminer mon application de gestion car je saurais comment accéder aux données.

  4. #4
    Membre confirmé
    Profil pro
    Inscrit en
    Décembre 2007
    Messages
    150
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2007
    Messages : 150
    Par défaut
    j'ai supprimer ce projet puis j'en ai crée un autre et ca marche, j'avais sans doute fait quelque chose lors de ma progression qui m'avait valut cette erreur

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Probleme compilation map.find
    Par olivier1978 dans le forum SL & STL
    Réponses: 15
    Dernier message: 07/09/2007, 19h54
  2. [JSF] mon premier JSF:Cannot find FacesContext
    Par anitshka dans le forum JSF
    Réponses: 15
    Dernier message: 24/08/2007, 18h19
  3. Cannot find FacesContext
    Par skanderb dans le forum JSF
    Réponses: 5
    Dernier message: 04/07/2007, 14h55
  4. erreur:Cannot find FacesContext
    Par oasma dans le forum JSF
    Réponses: 3
    Dernier message: 15/05/2007, 13h06
  5. [Data] probleme avec getHibernateTemplate.find()
    Par Tauros_king dans le forum Spring
    Réponses: 2
    Dernier message: 22/03/2007, 11h05

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo