Methods Summary |
---|
public int | doEndTag()Perform our logged-in user check by looking for the existence of
a session scope bean under the specified name. If this bean is not
present, control is forwarded to the specified logon page.
// Is there a valid user logged on?
boolean valid = false;
HttpSession session = pageContext.getSession();
if ((session != null) && (session.getAttribute(name) != null)) {
valid = true;
}
// Forward control based on the results
if (valid) {
return (EVAL_PAGE);
} else {
ModuleConfig config =
(ModuleConfig) pageContext.getServletContext().getAttribute(
org.apache.struts.Globals.MODULE_KEY);
try {
pageContext.forward(config.getPrefix() + page);
} catch (ServletException e) {
throw new JspException(e.toString());
} catch (IOException e) {
throw new JspException(e.toString());
}
return (SKIP_PAGE);
}
|
public int | doStartTag()Defer our checking until the end of this tag is encountered.
return (SKIP_BODY);
|
public java.lang.String | getName()Return the bean name.
// ----------------------------------------------------------- Properties
return (this.name);
|
public java.lang.String | getPage()Return the forward page.
return (this.page);
|
public void | release()Release any acquired resources.
super.release();
this.name = Constants.USER_KEY;
this.page = "/logon.jsp";
|
public void | setName(java.lang.String name)Set the bean name.
this.name = name;
|
public void | setPage(java.lang.String page)Set the forward page.
this.page = page;
|