작동하지 리디렉션 : -아약스이 내 JSF 코드
<h:commandButton id="cmdLogin" value="Login" actionListener="#{indexBean.login}">
<f:ajax execute="@form" render="@all" />
</h:commandButton>
이것은 indexBean 내 로그인 방법 : -
public void login(){
HttpServletResponse objHttpServletResponse = (HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse();
objHttpServletResponse.sendRedirect("Restricted/Home.jsf");
}
내가 자바 스크립트 emptyResponse: An empty response was received from the server. Check server error logs.
에 하나의 경고를 얻을. 이러한 유형의 리디렉션이 작동하지 않는 이유는 무엇입니까?
편집 : - 흥미롭게도 faces-config.xml에서 리디렉션하면 효과적입니다.
<faces-config version="2.0"
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_2_0.xsd">
<navigation-rule>
<from-view-id>/index.xhtml</from-view-id>
<navigation-case>
<from-outcome>Home</from-outcome>
<to-view-id>/Restricted/Home.jsf</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
</faces-config>
그리고 분명히, 내가 String
에 login
의 action
변경된 반환 형식에있는 명령의 actionListener
를 변경하고 로그인 방법에서 home
를 반환했습니다. 이것이 JSF에서 원하는 행동이라면 누구나 지금 말할 수 있습니까? faces-config.xml
에서 리디렉션하는 방법과 managedbean에서 간단한 리디렉션이 작동하지 않습니다.