action de mes boutons ne fonctionne pas
bonjour a tous ,
j'ai une page jsf dans laquell j'ai mis 5 bouton ,chaque bouton me rederige vers une autre page mais ce n'est pas le cas car seulement la premiere bouton fonctionne est les autre non. je vous donne le code de ma page jsf,faces-config et mon beans espérons que vous pouver m'aider merci.
page jsf :
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
| <%@ page contentType="text/html"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<f:view>
<html>
<head>
<title>JSF Simple Login Example</title>
</head>
<body>
<center>
<h:graphicImage value="./images/tap1.jpg" />
<h:form>
<table>
<tr>
<td>
</td>
<td>
<h:commandButton value="Login1" action="#{Tap_choice.TapChoice1}"/>
</td>
<td>
<h:commandButton value="Login2" action="#{Tap_choice.TapChoice2}"/>
</td>
<td>
<h:commandButton value="Login3" action="#{Tap_choice.TapChoice2}"/>
</td>
<td>
<h:commandButton value="Login4" />
</td>
<td>
<h:commandButton value="Login5" />
</td>
<td>
<h:commandButton value="Login6" />
</td>
<td>
<h:commandButton value="Login7" />
</td>
</tr>
</table>
</h:form>
</center>
</body>
</html>
</f:view> |
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
| <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">
<managed-bean>
<managed-bean-name>Tap_choice</managed-bean-name>
<managed-bean-class>Tap_beans.Tap_choice</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/Tap_choice.jsp</from-view-id>
<navigation-case>
<from-action>#{Tap_choice.TapChoice1}</from-action>
<from-outcome>choix1</from-outcome>
<to-view-id>/Tap_article.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{Tap_login.TapChoice2}</from-action>
<from-outcome>choix2</from-outcome>
<to-view-id>/Tap_article1.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config> |
le beans
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| package Tap_beans;
public class Tap_choice {
public Tap_choice(){}
public String TapChoice1(){
return "choix1";
}
public String TapChoice2(){
System.out.println("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
return "choix2";
}
public String TapChoice3(){
return "choix3";
}
public String TapChoice4(){
return "choix4";
}
} |