Tutorial issue - name doesnt appear on welcome.jsp [message #615713] |
Mon, 19 November 2007 15:01 |
Stu Plu Messages: 44 Registered: July 2009 |
Member |
|
|
Hi after my last posting I hesitated but here I am again.
Ok I've finished the tutorial and found it very easy to follow - excellent
stuff.
Just one thing. When I run it and enter a user name and user password this
does not appear on the welcome.sjp an indicated by the tutorial.
I ran in debug mode and the setter for userName is never called. Thus I
guess the variable is never set.
Any clues?
Here is the faces-config.xml and login.,jsp
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
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_1_2.xsd"
version="1.2">
<managed-bean>
<managed-bean-name>
loginBean</managed-bean-name>
<managed-bean-class>
com.tutorial.LoginBean</managed-bean-class>
<managed-bean-scope>
session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>
/login.jsp</from-view-id>
<navigation-case>
<from-outcome>login</from-outcome>
<to-view-id>
/welcome.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<display-name>
login</display-name>
<from-view-id>
/login.jsp</from-view-id>
<navigation-case>
<from-outcome>leave</from-outcome>
<to-view-id>
/leave.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<validator>
<description>
</description>
<display-name>
Validate Password</display-name>
<validator-id>
com.tutorial.validatePassword</validator-id>
<validator-class>
com.tutorial.ValidatePassword</validator-class>
</validator>
</faces-config>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%><%@taglib
uri="http://java.sun.com/jsf/core" prefix="f"%><%@ page language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login</title>
</head>
<body>
<f:view>
<f:loadBundle basename="com.tutorial.messages" var="msg"/>
<h:panelGrid border="1" columns="2">
<h:outputText id="userNameLabel" value="#{msg.name}" ></h:outputText>
<h:inputText id="userNameInputText"
value="#{loginBean.userName}"></h:inputText>
<h:outputText id="passwordLabel" value="#{msg.password}"></h:outputText>
<h:inputSecret id="passwordInputField" value="#{loginBean.userPassword }">
<f:validator validatorId="com.tutorial.validatePassword"/>
</h:inputSecret>
</h:panelGrid>
<h:form>
<h:commandButton id="loginButton" value="Login"
action="login"></h:commandButton>
<h:commandButton id="leaveButton" value="Leave"
action="leave"></h:commandButton>
</h:form></f:view></body>
</html>
|
|
|
Powered by
FUDForum. Page generated in 0.03133 seconds