當前位置: 首頁>>代碼示例>>Java>>正文


Java ActionContext.getContext方法代碼示例

本文整理匯總了Java中com.opensymphony.xwork2.ActionContext.getContext方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionContext.getContext方法的具體用法?Java ActionContext.getContext怎麽用?Java ActionContext.getContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.opensymphony.xwork2.ActionContext的用法示例。


在下文中一共展示了ActionContext.getContext方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
	ActionContext actionContext = ActionContext.getContext();
	int result = userManager.validLogin(getUser());
	if (result == LOGIN_SUCCESS) {
		ExpManager expManager = ExpManager.getInstance(userManager.getUserByAccount(user.getAccount()),
				userManager);
		if (!expManager.isLoginToday())
			user = expManager.addExp(ExpManager.LOGIN);
		user = userManager.updateLoginDate(userManager.getUserByAccount(user.getAccount()));
		actionContext.getSession().put(WebConstant.USER, userManager.getUserBeanByAccount(user.getAccount()));
		actionContext.getSession().put(WebConstant.AUTHORITY,
				userManager.getAuthorityBeanByAccount(user.getAccount()));
		actionContext.getSession().put(WebConstant.AUTHORITY_TABLE, userManager.getAllAuthorities());
		return SUCCESS;
	} else {
		actionContext.getSession().put(WebConstant.INTERCEPT, "Wrong account or password");
		return ERROR;
	}
}
 
開發者ID:CongBao,項目名稱:baozijuan.com,代碼行數:21,代碼來源:LoginAction.java

示例2: execute

import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
	ActionContext actionContext = ActionContext.getContext();
	int result = userManager.validRegist(getUser());
	if (result == REGIST_SUCCESS) {
		ExpManager expManager = ExpManager.getInstance(userManager.getUserByAccount(user.getAccount()),
				userManager);
		if (!expManager.isLoginToday())
			user = expManager.addExp(ExpManager.LOGIN);
		user = userManager.updateLoginDate(userManager.getUserByAccount(user.getAccount()));
		actionContext.getSession().put(WebConstant.VERIFY, user);
		return SEND_MAIL;
	} else {
		actionContext.getSession().put(WebConstant.INTERCEPT, "Account is existed");
		return ERROR;
	}
}
 
開發者ID:CongBao,項目名稱:baozijuan.com,代碼行數:18,代碼來源:RegistAction.java

示例3: execute

import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
	ActionContext actionContext = ActionContext.getContext();
	User user = userManager.getUserByAccount(getOldAccount());
	user.setPassword(getVerifyPassword());
	int result = userManager.validLogin(user);
	if (result == LOGIN_SUCCESS) {
		user.setPassword(getVerifyPassword());
		user = userManager.updateAccount(user, getNewAccount());
		if (user != null) {
			user = userManager.updateMailVerifyState(user, false);
			actionContext.getSession().put(WebConstant.USER, userManager.getUserBeanByAccount(user.getAccount()));
			actionContext.getSession().put(WebConstant.AUTHORITY,
					userManager.getAuthorityBeanByAccount(user.getAccount()));
			return SUCCESS;
		} else {
			actionContext.getSession().put(WebConstant.INTERCEPT_1, "Account is existed");
			return ERROR;
		}
	} else {
		actionContext.getSession().put(WebConstant.INTERCEPT_1, "Wrong Current Password");
		return ERROR;
	}
}
 
開發者ID:CongBao,項目名稱:baozijuan.com,代碼行數:25,代碼來源:EditAccountAction.java

示例4: execute

import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
	ActionContext actionContext = ActionContext.getContext();
	User user = userManager.getUserByAccount(getAccount());
	user.setPassword(getOldPassword());
	int result = userManager.validLogin(user);
	if (result == LOGIN_SUCCESS) {
		user = userManager.updatePassword(user, getNewPassword());
		actionContext.getSession().put(WebConstant.USER, userManager.getUserBeanByAccount(user.getAccount()));
		actionContext.getSession().put(WebConstant.AUTHORITY,
				userManager.getAuthorityBeanByAccount(user.getAccount()));
		return SUCCESS;
	} else {
		actionContext.getSession().put(WebConstant.INTERCEPT_2, "Wrong Current Password");
		return ERROR;
	}
}
 
開發者ID:CongBao,項目名稱:baozijuan.com,代碼行數:18,代碼來源:EditPasswordAction.java

示例5: lookupExtension

import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
protected String lookupExtension(String extension) {
    if (extension == null) {
        // Look for the current extension, if available
        ActionContext context = ActionContext.getContext();
        if (context != null) {
            ActionMapping orig = (ActionMapping) context.get(ServletActionContext.ACTION_MAPPING);
            if (orig != null) {
                extension = orig.getExtension();
            }
        }
        if (extension == null) {
            extension = getDefaultExtension();
        }
    }
    return extension;
}
 
開發者ID:txazo,項目名稱:struts2,代碼行數:17,代碼來源:DefaultActionMapper.java

示例6: execute

import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
public String execute() throws Exception {
        ActionContext previous = ActionContext.getContext();
        ActionContext.setContext(invocation.getInvocationContext());
        try {
// This is for the new API:
//            return RequestContextImpl.callInContext(invocation, new Callable<String>() {
//                public String call() throws Exception {
//                    return invocation.invoke();
//                }
//            });

            // 源碼解析: ActionInvocation調用
            return invocation.invoke();
        } finally {
            if (cleanupContext)
                ActionContext.setContext(previous);
        }
    }
 
開發者ID:txazo,項目名稱:struts2,代碼行數:19,代碼來源:StrutsActionProxy.java

示例7: createNewTopic

import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
public String createNewTopic(){
	
	ActionContext actionContext = ActionContext.getContext();
    Map session = actionContext.getSession();
    
    AcctUser user=(AcctUser)session.get("user");
    if(user==null){
    	return "login";
    }
	
	 List filters = new ArrayList();
	 PropertyFilter filter = new PropertyFilter("EQL_section.id", SECTIONID);
        filters.add(filter);
        nodes = bbsManager.findAllNodesByFitler(filters);
        
	for(Node n:nodes){
		System.out.println(n.getName());
	}
	
	return "createNewTopic";
}
 
開發者ID:muzili90,項目名稱:SpringBBS,代碼行數:22,代碼來源:TopicAction.java

示例8: execute

import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
	ActionContext actionContext = ActionContext.getContext();
	if (actionContext.getSession().get(WebConstant.USER) != null) {
		actionContext.getSession().put(WebConstant.USER, null);
		actionContext.getSession().put(WebConstant.AUTHORITY, null);
		actionContext.getSession().put(WebConstant.AUTHORITY_TABLE, null);
		return SUCCESS;
	} else {
		actionContext.getSession().put(WebConstant.INTERCEPT, "You haven't signed in.");
		return ERROR;
	}
}
 
開發者ID:CongBao,項目名稱:baozijuan.com,代碼行數:14,代碼來源:LogoutAction.java

示例9: execute

import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
	ActionContext actionContext = ActionContext.getContext();
	User user = (User) actionContext.getSession().get(WebConstant.RESET_PASS);
	if (user != null) {
		userManager.updatePassword(user, getPassword());
		actionContext.getSession().put(WebConstant.RESET_PASS, null);
		return LOGIN;
	} else {
		actionContext.getSession().put(WebConstant.INTERCEPT, "No account was required to reset password");
		return ERROR;
	}
}
 
開發者ID:CongBao,項目名稱:baozijuan.com,代碼行數:14,代碼來源:ResetPasswordAction.java

示例10: execute

import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
	ActionContext actionContext = ActionContext.getContext();
	User user = null;
	if ((user = (User) actionContext.getSession().get(WebConstant.VERIFY)) != null) {
		if (getCode().equalsIgnoreCase(MailManager.VerifyCode.getVerifyCode())) {
			user = userManager.updateMailVerifyState(user, true);
			actionContext.getSession().put(WebConstant.VERIFY, null);
			actionContext.getSession().put(WebConstant.USER, userManager.getUserBeanByAccount(user.getAccount()));
			actionContext.getSession().put(WebConstant.AUTHORITY,
					userManager.getAuthorityBeanByAccount(user.getAccount()));
			actionContext.getSession().put(WebConstant.AUTHORITY_TABLE, userManager.getAllAuthorities());
			return SUCCESS;
		} else {
			actionContext.getSession().put(WebConstant.INTERCEPT, "Wrong verification code");
			return ERROR;
		}
	} else if ((user = (User) actionContext.getSession().get(WebConstant.RESET_PASS)) != null) {
		if (getCode().equalsIgnoreCase(MailManager.VerifyCode.getVerifyCode())) {
			user = userManager.updateMailVerifyState(user, true);
			return RESET_PASS;
		} else {
			actionContext.getSession().put(WebConstant.INTERCEPT, "Wrong verification code");
			return ERROR;
		}
	} else {
		actionContext.getSession().put(WebConstant.INTERCEPT, "No account was required to verify");
		return ERROR;
	}
}
 
開發者ID:CongBao,項目名稱:baozijuan.com,代碼行數:31,代碼來源:MailVerifyAction.java

示例11: execute

import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
	ActionContext actionContext = ActionContext.getContext();
	if (account == null)
		return ERROR;
	if (userManager.isUserExist(getAccount())) {
		actionContext.getSession().put(WebConstant.RESET_PASS, userManager.getUserByAccount(account));
		return SEND_MAIL;
	} else {
		actionContext.getSession().put(WebConstant.INTERCEPT, "Account not exist");
		return ERROR;
	}
}
 
開發者ID:CongBao,項目名稱:baozijuan.com,代碼行數:14,代碼來源:ForgetPasswordAction.java

示例12: execute

import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
	ActionContext actionContext = ActionContext.getContext();
	User user = userManager.getUserByAccount(getAccount());
	if (user != null) {
		userManager.deleteAccount(user);
		return SUCCESS;
	} else {
		actionContext.getSession().put(WebConstant.INTERCEPT, "Error in deleting account");
		return ERROR;
	}
}
 
開發者ID:CongBao,項目名稱:baozijuan.com,代碼行數:13,代碼來源:DeleteAccountAction.java

示例13: execute

import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
	ActionContext actionContext = ActionContext.getContext();
	User user = userManager.getUserByAccount(account);
	if (user != null) {
		actionContext.getSession().put(WebConstant.VERIFY, user);
		return SEND_MAIL;
	} else {
		actionContext.getSession().put(WebConstant.INTERCEPT, "No account was required to verify");
		return ERROR;
	}
}
 
開發者ID:CongBao,項目名稱:baozijuan.com,代碼行數:13,代碼來源:VerifyReqAction.java

示例14: execute

import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String execute() throws Exception {
	ActionContext actionContext = ActionContext.getContext();
	User user = userManager.updateUserInfo(getUserBean());
	if (user != null) {
		actionContext.getSession().put(WebConstant.USER, userManager.getUserBeanByAccount(user.getAccount()));
		actionContext.getSession().put(WebConstant.AUTHORITY, userManager.getAuthorityBeanByAccount(user.getAccount()));
		return SUCCESS;
	} else {
		actionContext.getSession().put(WebConstant.INTERCEPT, "Error in update");
		return ERROR;
	}
}
 
開發者ID:CongBao,項目名稱:baozijuan.com,代碼行數:14,代碼來源:EditProfileAction.java

示例15: intercept

import com.opensymphony.xwork2.ActionContext; //導入方法依賴的package包/類
@Override
public String intercept(ActionInvocation invocation) throws Exception {
	ActionContext actionContext = ActionContext.getContext();
	UserBean user = (UserBean) actionContext.getSession().get(WebConstant.USER);
	AuthorityBean authority = (AuthorityBean) actionContext.getSession().get(WebConstant.AUTHORITY);
	if (user == null || authority == null) {
		actionContext.getSession().put(WebConstant.INTERCEPT, "Please login first");
		return Action.LOGIN;
	} else if (authority.getId() < 4) {
		actionContext.getSession().put(WebConstant.INTERCEPT, "Permission denied");
		return WebConstant.PERMISSION_DENIED;
	} else {
		return invocation.invoke();
	}
}
 
開發者ID:CongBao,項目名稱:baozijuan.com,代碼行數:16,代碼來源:LvThreeInterceptor.java


注:本文中的com.opensymphony.xwork2.ActionContext.getContext方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。