deepak.marur 0 Newbie Poster

Hi,

I'm writing a sample spring web flow app with jsf as view technology. I guess I've got everything right in terms of configuration. However when I click on the "login" commandbutton of the jsf page, the flow does not go the next view (Welcome). Am I missing something ?

main-flow.xml

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

	<view-state id="Login">
		<transition on="login" to="Welcome" />
		<transition on="cancel" to="Cancel"/>
	</view-state>
	
	<end-state id="Welcome" />
	<end-state id="Cancel" />
	
</flow>

Login.xhtml

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head><title>Spring Web flow with JSF</title></h:head>

<h:body>
	<h5>Please login to continue</h5>
	<h:form>
	<h:panelGrid columns="2">
		<h:outputText value="Username"/>
		<h:inputText value="#{loginBean.username}"/>
	
		<h:commandButton id="loginButton" action="login" value="Login" />
		<h:commandButton id="cancelButton" action="cancel" value="Cancel" />
	</h:panelGrid>
	</h:form>
</h:body>
</html>

Welcome.xhtml

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">

	<h:body>
		Welcome to Spring Web flow with JSF, <h:outputText value="#{loginBean.username}"/>
	</h:body>

</html>

@Component("loginBean")
public class LoginControllerBean implements Serializable {

	private String username;
	private String password;
	
	public String getUsername() {
		return username;
	}
	
	public void setUsername(String username) {
		this.username = username;
		System.out.println("Setting username to " + this.username);
	}
	
	public String getPassword() {
		return password;
	}
	
	public void setPassword(String password) {
		this.password = password;
		System.out.println("Setting password");
	}
	
}