我是 jsf 的新手,正在尝试构建应用程序。问题是当我单击登录命令按钮时没有任何反应。所以我输入了一些打印行,它告诉我与数据库的连接存在并且参数有效但它不会重定向。
这是 index.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!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://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Dezurstvo</title>
</h:head>
<h:body>
Login
<br />
<h:form>
<p:growl id="msgs" showDetail="true"/>
<h:panelGrid columns="2" cellpadding="5">
<h:outputText value="Username"/>
<p:inputText value="#{logIn.username}" required="true"/>
<h:outputText value="Password"/>
<p:password id="pass" value="#{logIn.password}" feedback="false" required="true"/>
</h:panelGrid>
<p:commandButton value="Login" action="#{logIn.loadUser()}" update="msgs" />
<p:commandButton value="Regisracija" />
</h:form>
<h:link outcome="adminMain" value="Primefaces welcome page" />
</h:body>
</html>
Run Code Online (Sandbox Code Playgroud)
NavigationBean 类
package beans;
import dataBeans.Korisnik;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;
@ManagedBean(name …Run Code Online (Sandbox Code Playgroud)