Spring webflow。无法找到与from-view-id'/login.xhtml'

时间:2015-10-11 05:32:43

标签: java spring jsf web flow

我是春天的新手,我对弹簧网流有一点问题。我已经在按钮点击上定义了转换,但是当我点击按钮时,这个消息显示在消息标记

Unable to find matching navigation case with from-view-id '/login.xhtml' for action 'doLogin' with outcome 'doLogin'

,这是在日志中

WARNING: JSF1064: Unable to find or serve resource, /doLogin.xhtml.

并没有发生任何事情。

project

这是我的web.xml

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">

            <context-param>
                <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                <param-value>.xhtml</param-value>
            </context-param>

            <context-param>
                <param-name>javax.faces.PROJECT_STAGE</param-name>
                <param-value>Development</param-value>
            </context-param>

            <context-param>
                <param-name>primefaces.THEME</param-name>
                <param-value>bootstrap</param-value>
            </context-param>

            <welcome-file-list>
                <welcome-file>login.jsf</welcome-file>
            </welcome-file-list>

            <servlet>
                <servlet-name>Faces Servlet</servlet-name>
                <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                <load-on-startup>1</load-on-startup>
            </servlet>

            <servlet-mapping>
                <servlet-name>Faces Servlet</servlet-name>
                <url-pattern>*.jsf</url-pattern>
                <url-pattern>*.xhtml</url-pattern>
            </servlet-mapping>

            <listener>
                <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
            </listener>

            <listener>
                <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
            </listener>

            <servlet>
                <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
                <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
                <init-param>
                    <param-name>contextConfigLocation</param-name>
                    <param-value></param-value>
                </init-param>
                <load-on-startup>2</load-on-startup>
            </servlet>

            <servlet-mapping>
                <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
                <url-pattern>/app/*</url-pattern>
            </servlet-mapping>

            <session-config>
                <session-timeout>30</session-timeout>
            </session-config>
</web-app>

的applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:webflow="http://www.springframework.org/schema/webflow-config"
    xmlns:faces="http://www.springframework.org/schema/faces"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/webflow-config
        http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd
        http://www.springframework.org/schema/faces
        http://www.springframework.org/schema/faces/spring-faces-2.2.xsd">

        <webflow:flow-executor id="flowExecutor">
        <webflow:flow-execution-listeners>
            <webflow:listener ref="facesContextListener" />
        </webflow:flow-execution-listeners>
    </webflow:flow-executor>

    <webflow:flow-registry id="flowRegistry"
        flow-builder-services="facesFlowBuilderServices" base-path="/WEB-INF/flows/">
        <webflow:flow-location-pattern value="**/*-flow.xml" />
    </webflow:flow-registry>

    <faces:flow-builder-services id="facesFlowBuilderServices" development="true" />

    <bean id="facesContextListener"
        class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener" />

    <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
        <property name="order" value="1" />
        <property name="flowRegistry" ref="flowRegistry" />
    </bean>

    <!-- Dispatches requests mapped to flows to FlowHandler implementations -->
    <bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter">
        <property name="flowExecutor" ref="flowExecutor" />
    </bean>
</beans>

登录-flow.xml

<?xml version="1.0" encoding="UTF-8" ?> 
 <flow  xmlns="http://www.springframework.org/schema/webflow" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:schemaLocation="http://www.springframework.org/schema/webflow 
        http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">

    <var name="loginBean" class="reagents/app/login/bean/LoginBean" /> 



    <view-state id="login" view="login.xhtml" >
        <transition on="doLogin" to="menu-flow" >
            <evaluate expression="loginBean.loginUser()" />
        </transition>
    </view-state>

    <end-state id="menu-flow" view="test.xhtml"></end-state>

    <!-- <end-state id="menu-flow" view="externalRedirect:WEB-INF/flows/menu/menu-flow.showReagents"></end-state> -->


 </flow>

login.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition 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">

    <h:head>
        <title>Login</title>
    </h:head>
    <h:body>
        <h:form>
            <h:outputLabel id="loginTittle" value="Přihlášení"/>
            <h:message id="loginMessage" for="loginPanel"/>
            <h:panelGrid  columns="2" id="loginPanel">

                <h:outputLabel id="LoginLabel" value="přihlašovací jméno" />
                <h:inputText id="loginValue" value="#{loginBean.loginName}"/>
                <h:outputLabel id="passwordLabel" value="heslo" />
                <h:inputText id="passwordValue" value="#{loginBean.password}"/>

                <h:commandButton id="loginButton" value="Přihlásit" action="doLogin"/>
            </h:panelGrid>
        </h:form>


    </h:body>
</html> 

和我的LoginBean.java

package reagents.app.login.bean;

import java.io.Serializable;
import javax.faces.bean.SessionScoped;
import reagents.data.user.UserDAOImpl;


@SessionScoped
public class LoginBean implements Serializable{
    private static final long serialVersionUID = 1L;
    private String loginName;
    private String password;

    public String getLoginName() {
        return loginName;
    }
    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }


    public Boolean loginUser(){
        System.out.println("AAAAAAA" + loginName + password);
        //UserDAOImpl u = new UserDAOImpl();
        //u.findByLogin(loginName);
        return true;
    }   
}

有人可以告诉我我做错了什么。非常感谢您的任何建议。

0 个答案:

没有答案