?? loginchecktag.java
字號:
package examonline.taglibs;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import examonline.utils.*;
public class LoginCheckTag
extends TagSupport {
private String forward;
private String type;
public LoginCheckTag() {
}
/**
*
*
* @return int
* @throws JspException
* @todo Implement this javax.servlet.jsp.tagext.Tag method
*/
public int doEndTag() throws JspException {
HttpSession session = pageContext.getSession();
HttpServletRequest request =(HttpServletRequest)pageContext.getRequest();
HttpServletResponse response =(HttpServletResponse)pageContext.getResponse();
Object key=null;
if("admin".equalsIgnoreCase(type))
key = session.getAttribute(Constants.LOGIN_ADMIN_KEY);
else if("student".equalsIgnoreCase(type))
key= session.getAttribute(Constants.LOGIN_USER_KEY);
if(key==null)
try {
// ActionErrors errors =new ActionErrors();
// errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("error.admin.notlogin"));
// request.setAttribute(Globals.ERROR_KEY, errors);
request.getRequestDispatcher(forward).forward(request, response);
return this.SKIP_PAGE;
}
catch (Exception ex) {
ex.printStackTrace();
}
return this.EVAL_PAGE;
}
/**
* release
*
* @todo Implement this javax.servlet.jsp.tagext.Tag method
*/
public void release() {
forward=null;
type=null;
}
public void setForward(String forward) {
this.forward = forward;
}
public void setType(String type) {
this.type = type;
}
public String getForward() {
return forward;
}
public String getType() {
return type;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -