public class LoginBean extends Object implements Serializable
Uses the annotations ManagedBean
.
It appears that I can't use the implicit objects for JSF expression language (param, request, response, etc.) in the ManagedBean annotations.
Constructor and Description |
---|
LoginBean()
This constructor reads the HTTP request parameter name and places
it in the user name field of the form.
|
Modifier and Type | Method and Description |
---|---|
String |
authorized()
Determines whether the combination of user name and user password represents
a valid user.
|
String |
getList()
Diagnostic routine listing session, application, and
request attributes.
|
String |
getPassword() |
SessionProperties |
getSessionBean() |
String |
getUserName() |
void |
setPassword(String value) |
void |
setSessionBean(SessionProperties value) |
void |
setUserName(String value) |
public LoginBean()
I had previously tried using #{param} in the ManagedBean annotation for a property, but it didn't seem to work. Some messages on the web indicated that it worked, but it may be implementation dependent.
The constructor will set the userName property to the value of the "name" parameter if the parameter is present.
FacesContext
,
ExternalContext
public String getUserName()
public void setUserName(String value)
public String getPassword()
public void setPassword(String value)
public String authorized()
In this case, the method accepts any login attempt using "password" for the password. In a real application, a more complicated algorithm would be used.
public String getList()
FacesContext
,
ExternalContext
public SessionProperties getSessionBean()
public void setSessionBean(SessionProperties value)
Copyright © 2017. All rights reserved.