public class CmsJspLoginBean extends CmsJspActionElement
Initialize this bean at the beginning of your JSP like this:
<jsp:useBean id="cmslogin" class="org.opencms.jsp.CmsJspLoginBean"> <% cmslogin.init(pageContext, request, response); %> </jsp:useBean>
NOT_INITIALIZED
构造器和说明 |
---|
CmsJspLoginBean()
Empty constructor, required for every JavaBean.
|
CmsJspLoginBean(javax.servlet.jsp.PageContext context,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Constructor, with parameters.
|
限定符和类型 | 方法和说明 |
---|---|
java.lang.String |
getFormLink()
Returns the link to the form that contains the login element.
|
CmsException |
getLoginException()
Returns the exception that was thrown after login,
or null if no Exception was thrown (i.e. login was successful
or not attempted).
|
CmsUser |
getUser()
Returns the currently logged in user.
|
java.lang.String |
getUserName()
Returns the user name of the currently logged in user.
|
boolean |
isLoggedIn()
Returns true if the current user is not the guest user,
i.e. if he already has logged in with some other user account.
|
boolean |
isLoginSuccess()
Indicates if a login was successful or not.
|
void |
login(java.lang.String userName,
java.lang.String password)
Logs a system user in to OpenCms.
|
void |
login(java.lang.String userName,
java.lang.String password,
java.lang.String projectName)
Logs a system user into OpenCms.
|
void |
login(java.lang.String userName,
java.lang.String password,
java.lang.String projectName,
java.lang.String redirectUri)
Logs a system user in to OpenCms.
|
void |
logout()
Logs a user out, i.e. destroys the current users session,
after that the current page will be redirected to itself one time to ensure that
the users session is truly destroyed.
|
editable, editable, editable, editableManualClose, editableManualOpen, getContent, getContent, getMessages, getMessages, getMessages, getMessages, getNavigation, getNavigationUri, img, img, include, include, include, include, include, include, includeSilent, includeSilent, includeSilent, includeSilent, info, label, link, link, properties, properties, property, property, property, property, template, template, template, toAbsolute, user
getCmsObject, getController, getJspContext, getMessage, getRequest, getRequestContext, getResponse, handleException, init, isNotInitialized, isSupressingExceptions, setContentType, setStatus, setSupressingExceptions
public CmsJspLoginBean()
public CmsJspLoginBean(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
context
- the JSP page context objectreq
- the JSP requestres
- the JSP responsepublic java.lang.String getFormLink()
public CmsException getLoginException()
public CmsUser getUser()
public java.lang.String getUserName()
public boolean isLoggedIn()
public boolean isLoginSuccess()
public void login(java.lang.String userName, java.lang.String password)
userName
- the users namepassword
- the passwordpublic void login(java.lang.String userName, java.lang.String password, java.lang.String projectName)
Note that if a login project name is provided, this project must exist, otherwise the login is regarded as a failure even if the user data was correct.
userName
- the users namepassword
- the passwordprojectName
- the project to switch to after login (if null project is not switched)public void login(java.lang.String userName, java.lang.String password, java.lang.String projectName, java.lang.String redirectUri) throws java.io.IOException
Note that if a login project name is provided, this project must exist, otherwise the login is regarded as a failure even if the user data was correct.
userName
- the users namepassword
- the passwordprojectName
- the project to switch to after login (if null project is not switched)redirectUri
- the URI to redirect to after login (if null the current URI is used)java.io.IOException
- in case redirect after login was not successfulpublic void logout() throws java.io.IOException
java.io.IOException
- if redirect after logout fails