Problème de navigation d'une page JSF à une autre !
Bonjour, excusez moi de mettre urgent en objet mais c'est urgent !:oops:
Bon, mon problème c'est la navigation de ma page createClient.jsp à clientCreated ne se fait pas bienque j'ai suivi la logique des choses... En voici mes classes et pages:
createClient.jsp
Code:
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
| <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<f:loadBundle basename="com.bank.bundle.messages" var="msg" />
<html>
<head>
<title>Create a client</title>
</head>
<body>
<h2 align="center">Create a client</h2>
<f:view>
<h:form id="add_client_form">
<h:outputText value ="#{msg.nom_client}"></h:outputText>
<h:inputText id="nomClient" value="#{clientBean.nomClient}" required="true">
<f:validateLength minimum="5" maximum="30" />
</h:inputText><br><br>
<h:outputText value ="#{msg.prenom_client}"></h:outputText>
<h:inputText id="prenomClient" value="#{clientBean.prenomClient}" required="true">
<f:validateLength minimum="5" maximum="30" />
</h:inputText><br><br>
<h:outputText value ="#{msg.code_client}"></h:outputText>
<h:outputText value ="#{msg.msg_code_client}"></h:outputText><br><br>
<h:outputText value ="#{msg.code_compte_client}"></h:outputText>
<h:outputText value ="#{msg.msg_code_compte_client}"></h:outputText><br><br>
<h:outputText value ="#{msg.mot_de_passe_client}"></h:outputText>
<h:inputText id="passwordClient" value="#{clientBean.passwordClient}" required="true">
<f:validateLength minimum="5" maximum="10" />
</h:inputText><br><br>
<h:outputText value ="#{msg.client_username_label}"></h:outputText>
<h:inputText id="clientUsername" value="#{clientBean.username}" required="true">
<f:validateLength minimum="5" maximum="20" />
</h:inputText><br><br>
<h:commandButton action = "#{clientBean.proceedClient}" value = "#{msg.btn_ajouter_client}"/>
<h:commandButton value = "#{msg.btn_reinit_client}" action = "#{clientBean.goToAgentPage}"/>
<%--type = "reset" --%>
</h:form>
<h:form>
<h:commandLink value="#{clientBean.link}" action="#{clientBean.goToAgentPage}">
<h:outputText value="#{msg.return_to_agent_page_link}"/>
</h:commandLink>
</h:form>
</f:view>
<!--<p><a href="/ExerciceBanque/Agent/JSPAgent.jsp">Return to your Agent page </a></p>-->
</body>
</html> |
faces-config.xml
Code:
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
| <?xml version='1.0' encoding='UTF-8'?>
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config version="1.2"
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-facesconfig_1_2.xsd">
<navigation-rule>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
<from-outcome>Agent</from-outcome>
<to-view-id>/Agent/JSPAgent.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>Client</from-outcome>
<to-view-id>/Client/JSPClient.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>Error</from-outcome>
<to-view-id>/Error.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/Agent/JSPAgent.jsp</from-view-id>
<navigation-case>
<from-outcome>consultation</from-outcome>
<to-view-id>/Agent/consultClientAcc.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>createClient</from-outcome>
<to-view-id>/Agent/createClient.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>deleteClient</from-outcome>
<to-view-id>/Agent/deleteClient.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>updateClient</from-outcome>
<to-view-id>/Agent/updateClient.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>errorAgentRequest</from-outcome>
<to-view-id>/Agent/ErrorAgentRequest.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/Agent/createClient.jsp</from-view-id>
<navigation-case>
<from-outcome>succeedCreateClient</from-outcome>
<to-view-id>/Agent/clientCreated.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>returnToAgent</from-outcome>
<to-view-id>/Agent/JSPAgent.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>loginBean</managed-bean-name>
<managed-bean-class>com.bank.bean.LoginBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>clientBean</managed-bean-name>
<managed-bean-class>com.bank.bean.ClientBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>manageAgentBean</managed-bean-name>
<managed-bean-class>com.bank.bean.ManageAgentBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config> |
ClientBean
Code:
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
| /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.bank.bean;
import com.bank.ado.ClientADO;
import com.bank.ado.CompteADO;
import com.bank.ado.TransactionADO;
import java.util.logging.Logger;
/**
*
* @author Sofien
*/
public class ClientBean {
private Logger logger = Logger.getLogger("com.bank.bean.ClientBean");
private String nomClient;
private String prenomClient;
private String passwordClient;
private String link;
private String username;
public String getNomClient() {
return nomClient;
}
public void setNomClient(String nomClient) {
this.nomClient = nomClient;
}
public String getPrenomClient() {
return prenomClient;
}
public void setPrenomClient(String prenomClient) {
this.prenomClient = prenomClient;
}
public String getPasswordClient() {
return passwordClient;
}
public void setPasswordClient(String passwordClient) {
this.passwordClient = passwordClient;
}
public String proceedClient() {
logger.info("Accessing succes page !");
ClientADO clientADO = new ClientADO();
int code = new ClientADO().getNewClientID();
int codeCompte = new CompteADO().getNewCompteID();
int codeTransac = new TransactionADO().getNewTransacID();
//creation of a transaction
new TransactionADO().addTransaction(codeTransac);
//creation of the client account
new CompteADO().addCompte(codeCompte);
clientADO.addClient(nomClient, prenomClient, code, codeCompte, codeTransac, passwordClient, username);
return ("succeedCreateClient");
}
public String goToAgentPage() {
return ("returnToAgent");
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
} |
Il se peut que qqc m'échappe ... :oops: Merci !