Bonjour,

Je débute en JSF et je suis actuellement bloqué sur mon formulaire de login.

je ne parviens pas à trouver la solution et j'ai l'impression que mon code est bon.

mon formulaire n'a pas d'erreur
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
 
 
<!DOCTYPE html>
<html xmlns:f="http://xmlns.jcp.org/jsf/core" 
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://xmlns.jcp.org/jsf/passthrough">
    <f:view>
        <head>
            <title>Login screen</title>
            <link rel="stylesheet" type="text/css" href="styles.css" />
        </head>
        <body>
            <h1><h:outputText value="Connectez-vous" /></h1>
 
           <!--  <h:messages showDetail="true" layout="table" showSummary="true" /> -->
            <!--   <h:messages styleClass="errorBlock"/> -->
 
            <h:form id="loginForm">
 
                Email: 
                <h:inputText id="email" value="#{loginBean.email}" 
                						required="true" p:required="true"
                						requiredMessage="Email obligatoire"
                						validatorMessage="Le login doit correspondre à un email">
                	<f:validateRegex pattern="^[\w.+-]+@[\w.+-]+\.[a-z]{2,}$"/>
                </h:inputText>
                <h:message for="login" styleClass="errorBlock"/>
 
                <br/>
 
                Password:
                <h:inputSecret id="password" value="#{loginBean.password}" 
                						required="true" p:required="true"
                						requiredMessage="Mot de passe obligatoire"
                						validatorMessage="Votre mot de passe doit contenir entre 3 à 12 caractères">
                	<f:validateLength minimum="2" maximum="12" />
                </h:inputSecret>
                <h:message for="password" styleClass="errorBlock"/>
 
                <br/>
 
                <h:commandButton action="#{loginBean.connexion}" value="Connect" />
 
           </h:form>
        </body>
    </f:view>
</html>

Mon Bean est très simple

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
 
 
package fr.joss.jsf.beanManage;
 
import java.io.Serializable;
 
import javax.faces.bean.SessionScoped;
import javax.inject.Named;
 
@Named(value = "loginBean")
@SessionScoped
public class LoginBean implements Serializable {
 
 
	private static final long serialVersionUID = 1L;
 
	private String email;
    private String password;
 
    //@ManagedProperty(value = "#{utilisateurMB}")
    //private Utilisateur utilisateur;
 
    public LoginBean() {
	}
 
 
    public String getEmail() {
        System.out.println( "in getLogin" );
        return email;
    }
 
 
	public void setEmail(String email) {
        System.out.println( "in setLogin with " + email );
        this.email = email;
    }
 
    public String getPassword() {
        System.out.println( "in getPassword" );
        return password;
    }
 
    public void setPassword(String password) {
        System.out.println( "in setPassword with " + password );
        this.password = password;
    }
 
    public String connexion() {
    	if(this.email.equals("joack@gmail.com") )
    		return "success";
 
 
    	return null;
 
    }
 
}
et pourtant je ne parviens pas à me débloquer.
voici l'erreur que j'ai en retour.

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

2020-03-30T11:28:38.316+0200|Avertissement: /login.xhtml @22,80 value="#{loginBean.email}": Target Unreachable, identifier 'loginBean' resolved to null
javax.el.PropertyNotFoundException: /login.xhtml @22,80 value="#{loginBean.email}": Target Unreachable, identifier 'loginBean' resolved to null
	at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:64)
	at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:71)
	at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1105)
	at javax.faces.component.UIInput.validate(UIInput.java:1006)
	at javax.faces.component.UIInput.executeValidate(UIInput.java:1317)
	at javax.faces.component.UIInput.processValidators(UIInput.java:733)
	at javax.faces.component.UIForm.processValidators(UIForm.java:229)
	at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:921)
	at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1309)
	at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:53)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:76)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
	at javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:707)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:451)
	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1540)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:119)
	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:550)
	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:75)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:114)
	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:199)
	at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:439)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:144)
	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182)
	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156)
	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218)
	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:515)
	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
	at java.lang.Thread.run(Thread.java:745)
Caused by: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'loginBean' resolved to null
	at com.sun.el.parser.AstValue.getTarget(AstValue.java:149)
	at com.sun.el.parser.AstValue.getType(AstValue.java:61)
	at com.sun.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:177)
	at org.jboss.weld.module.web.el.WeldValueExpression.getType(WeldValueExpression.java:93)
	at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
	... 41 more
je n'arrive pas a m'en sortir quelqu'un peu me mettre sur la vois?
voici le contenu de mon fichier 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
 
 
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
    xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd"
    version="2.3">
    <!-- Navigation si je suis en succes sur login.xhtml alors je peux aller sur  viewArticle.xhtml-->
 
   <!--  --> 
    <navigation-rule>
        <from-view-id>/login.xhtml</from-view-id>
        <navigation-case>
            <from-outcome>success</from-outcome>
            <to-view-id>/home.xhtml</to-view-id>
        </navigation-case>
    </navigation-rule>
 
</faces-config>