samedi 10 octobre 2015

Spring webflow. Unable to find matching navigation case with from-view-id '/login.xhtml'

I'm new with spring and I have a little problem with spring web flow. I have defined transitions on button click but when i click on button this mesage is shown in mesages tag

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

and this is in log

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

and nothing happened.

project

this is my web.xml

<web-app xmlns:xsi="http://ift.tt/ra1lAU"
xmlns="http://ift.tt/nSRXKP"
xsi:schemaLocation="http://ift.tt/nSRXKP http://ift.tt/LU8AHS"
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://ift.tt/GArMu6"
    xmlns:xsi="http://ift.tt/ra1lAU" xmlns:webflow="http://ift.tt/19rsrif"
    xmlns:faces="http://ift.tt/KwCEOo"
    xsi:schemaLocation="
        http://ift.tt/GArMu6
        http://ift.tt/QEDs1e
        http://ift.tt/19rsrif
        http://ift.tt/KwCEOq
        http://ift.tt/KwCEOo
        http://ift.tt/KwCHtI">

        <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>

login-flow.xml

<?xml version="1.0" encoding="UTF-8" ?> 
 <flow  xmlns="http://ift.tt/1jwD1YA" 
        xmlns:xsi="http://ift.tt/ra1lAU" 
        xsi:schemaLocation="http://ift.tt/1jwD1YA 
        http://ift.tt/KWn2UK">

    <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://ift.tt/kkyg93">
<html xmlns="http://ift.tt/lH0Osb"
    xmlns:h="http://ift.tt/HjFrZb">

    <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> 

and my 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;
    }   
}

Can someone give me an advice what I'm doing wrong. Thank you very much for any advice.




Aucun commentaire:

Enregistrer un commentaire