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 :

BackingBean + CommandButton


Sujet :

JSF Java

  1. #1
    Membre éclairé Avatar de snipes
    Inscrit en
    Septembre 2004
    Messages
    547
    Détails du profil
    Informations forums :
    Inscription : Septembre 2004
    Messages : 547
    Par défaut BackingBean + CommandButton
    Bonjour tout le monde,

    j'ai un petit soucis d'appel a une methode de mon backingbean a partir d'un commandButton, ca marchait tres bien jusqu'a maintenant mais la je me rend compte que c'est plus du tout le cas
    (je me demande si ca proviendrai pas du fait que maintenant je test avec un projet JSF 1.1.01 RI With Facelet, auparavant je faisais plutot des projets JSF 1.1.01 RI)

    j'ai droit au message d'erreur suivant :

    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
    ERROR [InvokeApplicationPhase] #{userBean.doAuthentification}: javax.faces.el.EvaluationException: /pages/login.xhtml @111,86 action="#{userBean.doAuthentification}": java.lang.NullPointerException
    javax.faces.FacesException: #{userBean.doAuthentification}: javax.faces.el.EvaluationException: /pages/login.xhtml @111,86 action="#{userBean.doAuthentification}": java.lang.NullPointerException
    	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
    	at javax.faces.component.UICommand.broadcast(UICommand.java:312)
    	at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
    	at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
    	at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:329)
    	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
    	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
    	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
    	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    	at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
    	at java.lang.Thread.run(Unknown Source)
    Caused by: javax.faces.el.EvaluationException: /pages/login.xhtml @111,86 action="#{userBean.doAuthentification}": java.lang.NullPointerException
    	at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
    	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
    	... 26 more
    Caused by: java.lang.NullPointerException
    	at org.cgssm.magma.web.beans.UserBean.doAuthentification(UserBean.java:134)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at com.sun.el.parser.AstValue.invoke(AstValue.java:151)
    	at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
    	at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
    	at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
    	... 27 more
    03:24:20,226 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
    javax.faces.FacesException: #{userBean.doAuthentification}: javax.faces.el.EvaluationException: /pages/login.xhtml @111,86 action="#{userBean.doAuthentification}": java.lang.NullPointerException
    	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
    	at javax.faces.component.UICommand.broadcast(UICommand.java:312)
    	at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
    	at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
    	at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:329)
    	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
    	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
    	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
    	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    	at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
    	at java.lang.Thread.run(Unknown Source)
    Caused by: javax.faces.el.EvaluationException: /pages/login.xhtml @111,86 action="#{userBean.doAuthentification}": java.lang.NullPointerException
    	at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
    	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
    	... 26 more
    Caused by: java.lang.NullPointerException
    	at org.cgssm.magma.web.beans.UserBean.doAuthentification(UserBean.java:134)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at com.sun.el.parser.AstValue.invoke(AstValue.java:151)
    	at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
    	at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
    	at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
    	... 27 more

  2. #2
    Membre éclairé Avatar de snipes
    Inscrit en
    Septembre 2004
    Messages
    547
    Détails du profil
    Informations forums :
    Inscription : Septembre 2004
    Messages : 547
    Par défaut
    Citation Envoyé par snipes Voir le message
    (je me demande si ca proviendrai pas du fait que maintenant je test avec un projet JSF 1.1.01 RI With Facelet, auparavant je faisais plutot des projets JSF 1.1.01 RI)
    Je viens de faire un test avec un projet bidon ca confirme ce que je disais
    Le fait de creer un projet : JSF 1.1.01 RI With Facelet, m empeche d'associer une methode du backing bean a mon commandbutton

    J'aimerai bien savoir pourquoi, si quelqu'un a une idée ?

    je post le code de test

    backingbean que j'ai ajouté dans faces-config.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
    package org.cgssm.op2.web.beans;
     
    public class userBean {
     
    	private String nom;
    	private String prenom;
    	public userBean() {
    		super();
    		// TODO Raccord de constructeur auto-généré
    	}
    	public String getNom() {
    		return nom;
    	}
    	public void setNom(String nom) {
    		this.nom = nom;
    	}
    	public String getPrenom() {
    		return prenom;
    	}
    	public void setPrenom(String prenom) {
    		this.prenom = prenom;
    	}
     
    	public String doAuthentification(){
    		return "ok";
    	}
    }
    page .xhtml
    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
    <!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:h="http://java.sun.com/jsf/html"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:f="http://java.sun.com/jsf/core">
     
    <ui:composition template="/template/template.xhtml">
    	<ui:define name="corp">
    		<h1>dinw</h1>
    		<h:form>
    			<h:outputText value="nom"/>
    			<h:inputText value="#{userBean.nom}"/>
    			<h:commandButton value="ok" action="#{userBean.doAuthentification}"/>
    		</h:form>
    	</ui:define>
    </ui:composition>
    </html>
    userBean.doAuthentification qui pose probleme. La complétion ne m'affiche aucune méthode non plus

    PS : J'ai créé un projet JSF 1.1.01 RI simple, jlui ai rajouté la lib jsf-facelets, j'ai transformé mes pages (mise en place d'un template+page.xhtml) et ben j'en reviens au point de départ, meme erreur
    Donc soit les pages .xhtml ont un probleme avec les méthodes des backing bean ou soit c'est la lib ou y'a certainement un truk que j'ai pas comprit lol

  3. #3
    Rédacteur

    Profil pro
    Inscrit en
    Juin 2003
    Messages
    4 184
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 4 184
    Par défaut
    tu n'a pas modifier la fonction du backing bean
    il y'a un NullPointerException dedans:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    Caused by: java.lang.NullPointerException
    	at org.cgssm.magma.web.beans.UserBean.doAuthentification(UserBean.java:134)

  4. #4
    Membre éclairé Avatar de snipes
    Inscrit en
    Septembre 2004
    Messages
    547
    Détails du profil
    Informations forums :
    Inscription : Septembre 2004
    Messages : 547
    Par défaut
    Citation Envoyé par Sniper37 Voir le message
    tu n'a pas modifier la fonction du backing bean
    il y'a un NullPointerException dedans:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    Caused by: java.lang.NullPointerException
    	at org.cgssm.magma.web.beans.UserBean.doAuthentification(UserBean.java:134)
    pas modifié c'est a dire ? j'ai vu le NullPointerException mais bon je ne vois pas a quoi il correspond, c'est une methode toute simple qui retourne un String

  5. #5
    Membre Expert Avatar de nathieb
    Homme Profil pro
    DevOps
    Inscrit en
    Mai 2004
    Messages
    1 058
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 58
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : DevOps
    Secteur : Service public

    Informations forums :
    Inscription : Mai 2004
    Messages : 1 058
    Par défaut Pas d'erreur
    Bonjour,

    D'après ce que je lis par d'erreur notoire, par contre si tu utilises
    netbeans tu peux utiliser la complétion automatique de ton éditeur
    pour voir si tu as bien configuré ton bean . En fonction de
    ton objet {#monobjet. -> complétion, parfois on a des suprises.

    Sinon utilises JSF1.2, et regarde les compatibilité avec facelets.

    Cordialement.

  6. #6
    Membre Expert Avatar de nathieb
    Homme Profil pro
    DevOps
    Inscrit en
    Mai 2004
    Messages
    1 058
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 58
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : DevOps
    Secteur : Service public

    Informations forums :
    Inscription : Mai 2004
    Messages : 1 058
    Par défaut lib
    Remarque

    vérifie que tu as bien el-api + el-impl si JSF de sun.
    C'est parfois un peux le foutoir dans les librairies.

    olivier

  7. #7
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    Caused by: java.lang.NullPointerException
    	at org.cgssm.magma.web.beans.UserBean.doAuthentification(UserBean.java:134)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    Ton erreur elle est à chercher là, pas ailleurs. Il faut d'abord regarder ce qu'il y exactement à ta ligne 134. Au passage, ton code est pas cohérent avec ton erreur. Si je lit ton code, il n'y a pas 134 lignes dans le UserBean.java, de plus, le stacktrace mentionne UserBean avec une majuscule, ton code a une classe avec une minuscule. De plus, les noms de package sont pas les même. Tu regarde donc probablement la mauvaise classe.

  8. #8
    Membre éclairé Avatar de snipes
    Inscrit en
    Septembre 2004
    Messages
    547
    Détails du profil
    Informations forums :
    Inscription : Septembre 2004
    Messages : 547
    Par défaut
    effectivement le probleme venait bien de la ligne 134 !
    sinon pour la complétion automatique je sais pas pourquoi ca marche pas
    merci pour ton aide !

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

Discussions similaires

  1. [JSF] Conception backingbean: patterns & architecture
    Par mauvais_karma dans le forum JSF
    Réponses: 5
    Dernier message: 08/03/2006, 18h51
  2. Réponses: 14
    Dernier message: 21/01/2006, 17h05
  3. [JFRAME]-[DEBUTANT] Placer un CommandButton dans un JFrame
    Par Hoegaarden dans le forum Agents de placement/Fenêtres
    Réponses: 3
    Dernier message: 19/12/2005, 15h22
  4. VBA Excel : CommandButtons et callback
    Par Raoul d'Andrésy dans le forum Macros et VBA Excel
    Réponses: 13
    Dernier message: 14/12/2005, 14h15
  5. Commandbutton sur feuille Excel
    Par delamarque dans le forum Macros et VBA Excel
    Réponses: 25
    Dernier message: 24/11/2005, 16h17

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