You aren't using JSF in any way - this is a plain HTML page that invokes a JSP (which doesn't contain any JSF tags).
To reformulate the login page as a JSF JSP, you might write it something like this:
<?xml version="1.0" encoding="UTF-8" ?><jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"><jsp:directive.page
language="java"
contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" /><jsp:text><![CDATA[<?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"> ]]>
</jsp:text>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<f:view>
<h:form>
user: <h:inputText value="#{idhandler.username}" /><br />
pw: <h:inputText value="#{idhandler.password}" /><br />
<h:commandButton value="login" action="#{idhandler.validateUser}" />
</h:form>
</f:view>
</body>
</html>
</jsp:root>
This defines a JSF view with a form control that contains two text input controls and a button. The inputs and button are bound to a managed bean. The managed bean might look like this:
public class LoginManager {
private String username;
private String password;
public String getUsername() { return username; }
public void setUsername(String username) { this.username = username; }
public String getPassword() { return password; }
public void setPassword(String password) { this.password = password; }
public String validateUser() {
// TODO: check login details
boolean authenticated = true;
return authenticated ? "goProcessUserInfo" : "errorPage";
}
}
The return value of the validateUser
method is used for matching the <from-outcome>
of the navigation case. The managed bean would be defined in your faces-config.xml
:
<managed-bean>
<managed-bean-name>idhandler</managed-bean-name>
<managed-bean-class>dsassignment1java.LoginManager</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
FYI: when writing JSF applications, you minimise the use of any standard actions (jsp:...
tags in the http://java.sun.com/JSP/Page
namespace), usually avoid JSTL tags (<c:...
tags in the http://java.sun.com/jsp/jstl/...
namespaces) and never use scriptlets (<% ... %>
view-embedded code).
See the JavaServer Faces section of the JEE5 tutorial for more.