probleme Navigation Rules
bonsoir
j'ai une page jsp nomme consultationBcn dont le code est le suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<f:view>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Consultation BCN</title>
</head>
<body>
<h:form>
<h1 style="font-size: 30px; font-family: arial; color:blue">CONSULTATION B.C.N</h1>
<h:panelGrid columns="3" border="5" style="background-color:Orange">
<h:outputText value="Numero B.C.N"></h:outputText>
<h:inputText id="numbcn" value="#{consultationBcn.numBcn}"></h:inputText>
<h:commandButton value="Afficher" type="submit" action="#{consultationBcn.afficher}"></h:commandButton>
</h:panelGrid>
</h:form>
</body>
</f:view>
</html> |
le bean associé est le suivant :
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
| public class ConsultationBcn
{
private Bcn b;
private int numbcn;
public ConsultationBcn(){}
void setNumBcn(int numbcn)
{
this.numbcn=numbcn;
}
public int getNumBcn()
{
return numbcn;
}
public String afficher()
{
ConsultationBcn cb= new ConsultationBcn();
int num =cb.getNumBcn();
try
{
_RootDAO.initialize();
BcnDAO tbcn= new BcnDAO();
List<Bcn> l = tbcn.findAll();
Iterator <Bcn> i = l.iterator();
while (i.hasNext())
{
b=(Bcn) i.next();
if (b.getNBcn()== num)
{
return "J_A";
}
}
}
catch(HibernateException e){}
;
return "J_E";
}
} |
dans le faces-Config.xml j'ai ajouté ces lignes de codes pour la redirection :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| <navigation-rule>
<display-name>ConsultationBCN</display-name>
<from-view-id>/ConsultationBCN.jsp</from-view-id>
<navigation-case>
<from-outcome>J_A</from-outcome>
<to-view-id>/AfficheBcn.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<display-name>ConsultationBCN</display-name>
<from-view-id>/ConsultationBCN.jsp</from-view-id>
<navigation-case>
<from-outcome>J_E</from-outcome>
<to-view-id>/AfficheErreurBcn.jsp</to-view-id>
</navigation-case>
</navigation-rule> |
j'ai essayé de recuperer l'attribut numbcn dans la page afficheBcn.jsp pour tester les navigations rules mais rien ne se passe !!!
y a t-il une solution ??