안녕하세요. 두 개의 XHTML 페이지가 있습니다. 1-login.jsf 2-menu.jsf 버튼을 클릭하여 페이지 1에서 페이지 2로 이동하려고했으나 여기서는 작동하지 않습니다. 여기 login.jsf 여기h : commandButton이 다른 jsf 페이지로 리디렉션되지 않음
<!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">
<head>
<link rel="stylesheet" type="text/css" href="../css/styles.css"/>
</head>
<h:body>
<h:form id="LoginForm">
<h:panelGrid style= "width: 467px; height: 88px">
<h:outputLabel value="Login"/>
<h:inputText value="#{loginBean.login}" id="loginID" />
<h:message for="loginID" tooltip="true" showDetail="true" showSummary="true" style="COLOR: #ff0000;"/>
<h:outputLabel value="Mot de Passe"/>
<h:inputSecret value="#{loginBean.password}" id="pwdID" />
<h:message for="pwdID" tooltip="true" showDetail="true" showSummary="true" style="COLOR: #ff0000;"/>
<h:message />
</h:panelGrid>
<h:commandButton id="validerID" value="Valider" action="#{loginBean.authentification}" type="submit"/>
<h:commandButton id="resetID" value="Reset" type="reset"/>
</h:form>
</h:body>
</html>
그리고 ManagedBean은의 코드입니다 : 내 코드는
패키지 com.fst.bibliotheque.beans;
import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext;
공용 클래스 LoginBean {
private String login;
private String password;
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String authentification(){
FacesContext fc=FacesContext.getCurrentInstance();
if("admin".equals(this.login) && "admin".equals(password)){
return "success";
}else{
if(!"admin".equals(this.login)){
fc.addMessage("LoginForm:loginID",new FacesMessage(FacesMessage.SEVERITY_INFO,"Validation Login","Login "+this.login+" inexistant!!"));
}
if(!"admin".equals(this.password)){
fc.addMessage("LoginForm:pwdID",new FacesMessage(FacesMessage.SEVERITY_INFO, "Validation Pwd","Vérifier votre mot de passe!!"));
}
return "echec";
}
}
}
마지막으로 여기는 execuring applcation 후 내 콘솔
<navigation-rule>
<display-name>pages/login.xhtml</display-name>
<from-view-id>/pages/login.xhtml</from-view-id>
<navigation-case>
<from-action>#{LoginBean.authentification()}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/pages/menu.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
내가이가 얼굴-config.xml 파일의 탐색 규칙입니다 : janv. 09, 2014 11:00:41 PM com.sun.faces.renderkit.html_basic.MessageRenderer encodeEnd 경고 : 'for'속성은 null 일 수 없습니다. 어느 곳에서 문제가 발생하는지 알고 계십니까?
들으는하지만이 problem.In 사실 내 관리 빈의 이름을 해결하지 않습니다 대문자 "L"의 LoginBean입니다. – user3179505
'authentification()은 실제로 호출 되었습니까? Bean이 실제로 LoginBean으로 명명 되었기 때문에''의 액션이 잘못되었거나 여기에 오타가 있기 때문입니다. –
그 문제가 해결 된 :) – user3179505