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


Java ActionContext類代碼示例

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


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

示例1: execute

import com.opensymphony.xwork2.ActionContext; //導入依賴的package包/類
@Override
public String execute() throws Exception {
	String userName = (String)ActionContext.getContext().getSession().get("userName");
	if(userName == null) {
		errorMsg = "用戶未登錄!";
		return ERROR;
	}
	try {
		Controller.execute();
		PushMail.PushUpdateMail(userName);
	} catch(Exception e) {
		errorMsg = "推送失敗!";
		return ERROR;
	}
	success = true;
	return SUCCESS;
}
 
開發者ID:wrayzheng,項目名稱:webpage-update-subscribe,代碼行數:18,代碼來源:PushAction.java

示例2: execute

import com.opensymphony.xwork2.ActionContext; //導入依賴的package包/類
@Override
public String execute() throws Exception {
	String userName = (String)ActionContext.getContext().getSession().get("userName");
	if(userName == null) {
		errorMsg = "用戶未登錄!";
		return ERROR;
	}
	try {
		ContentHandler.testRemoveSomeRecords(userName, 5);
	} catch (Exception e) {
		errorMsg = "測試刪除部分數據失敗!";
		return ERROR;
	}
	success = true;
	return SUCCESS;
}
 
開發者ID:wrayzheng,項目名稱:webpage-update-subscribe,代碼行數:17,代碼來源:TestAction.java

示例3: addUrl

import com.opensymphony.xwork2.ActionContext; //導入依賴的package包/類
public String addUrl() {
	String userName = (String)ActionContext.getContext().getSession().get("userName");
	try {
		IUrlDAO urlDAO = UrlDAOFactory.getUrlDAOInstance();
		urlID = urlDAO.doInsert(userName, title, url, true, realTimePush);
		if(-1 == urlID) {
			errorMsg = "添加記錄失敗!";
		} else {
			success = true;
			return SUCCESS;
		}
	} catch (Exception e) {
		errorMsg = "訪問數據庫出錯!";
		e.printStackTrace();
	}
	return ERROR;
}
 
開發者ID:wrayzheng,項目名稱:webpage-update-subscribe,代碼行數:18,代碼來源:UrlOperateAction.java

示例4: toRoomManageFail

import com.opensymphony.xwork2.ActionContext; //導入依賴的package包/類
@Action(value = "toRoomManageFail")
public void toRoomManageFail() throws Exception{
	if(ActionContext.getContext().get("msg")!=null)
		request.setAttribute("msg", ActionContext.getContext().get("msg"));
	Customer cus = (Customer) session.get("customer");
	String phoneNumber = cus.getPhoneNumber();
	System.out.println("phoneNumber--" + phoneNumber );
	
	//1、先根據該用戶電話號碼得到,password對象
	
	Password passwd = passwordService.getPasswordByPhone (phoneNumber);	
	
	if(passwd == null) {
		// 代表無可用房間
		writeStringToResponse("1");
	} else 
		writeStringToResponse("0");
	

}
 
開發者ID:liuxuanhai,項目名稱:WeiXing_xmu-2016-MrCode,代碼行數:21,代碼來源:RoomManageAction.java

示例5: toRoomManage

import com.opensymphony.xwork2.ActionContext; //導入依賴的package包/類
@Action(value = "toRoomManage", results = { @Result(name = "toRoomManage", location = ViewLocation.View_ROOT
				+ "management.jsp") })
		public String toRoomManage() throws Exception{
			if(ActionContext.getContext().get("msg")!=null)
				request.setAttribute("msg", ActionContext.getContext().get("msg"));
			Customer cus = (Customer) session.get("customer");
			String phoneNumber = cus.getPhoneNumber();
			System.out.println("phoneNumber--" + phoneNumber );
			
			//1、先根據該用戶電話號碼得到,password對象
			
			Password passwd = passwordService.getPasswordByPhone (phoneNumber);	
			
//			if(passwd == null) {
//				
//				writeStringToResponse("1");
//			}
			
			System.out.println("輸出Password id--" + passwd.getId());
			//2、根據該password對象,得到roomId
			Room room = passwd.getRoom();
			System.out.println(room.getId());
			
//			懶加載:System.out.println("獲取hotel--"  + room.getRoomtype().getHotel().getName());
			
			//3、根據roomId 獲取房間類型
			//RoomType roomtype = roomService.getRoomTypeByRoomId();
			 request.setAttribute("customer", cus);
			 request.setAttribute("roomid", room.getId());
			 request.setAttribute("roomnumber", room.getRoomNumber());
			return "toRoomManage";
		}
 
開發者ID:liuxuanhai,項目名稱:WeiXing_xmu-2016-MrCode,代碼行數:33,代碼來源:RoomManageAction.java

示例6: execute

import com.opensymphony.xwork2.ActionContext; //導入依賴的package包/類
public String execute() throws Exception {

		String res = "input";

		Map<String, Object> session = ActionContext.getContext().getSession();
		user = (User) session.get("webshop_user");
		if(user != null && (user.getRole().getTyp().equals("admin"))) {
			CategoryManager categoryManager = new CategoryManagerImpl();
			// Add category
			categoryManager.addCategory(newCatName);
			
			// Go and get new Category list
			this.setCategories(categoryManager.getCategories());
			
			res = "success";
		}
		
		return res;
	
	}
 
開發者ID:mavogel,項目名稱:hska-vis-legacy,代碼行數:21,代碼來源:AddCategoryAction.java

示例7: execute

import com.opensymphony.xwork2.ActionContext; //導入依賴的package包/類
public String execute() throws Exception {
	
	String res = "input";

	Map<String, Object> session = ActionContext.getContext().getSession();
	user = (User) session.get("webshop_user");
	boolean isAdmin = true;
	if(user != null && isAdmin) {

		CategoryManager categoryManager = new CategoryManagerImpl();
		this.setCategories(categoryManager.getCategories());
		
		if(pageToGoTo != null){
			if(pageToGoTo.equals("c")){
				res = "successC";	
			}
			else if(pageToGoTo.equals("p")){
				res = "successP";
			}				
		}
	}
	
	return res;
}
 
開發者ID:mavogel,項目名稱:hska-vis-legacy,代碼行數:25,代碼來源:InitCategorySiteAction.java

示例8: execute

import com.opensymphony.xwork2.ActionContext; //導入依賴的package包/類
public String execute() throws Exception {
	String result = "input";
	Map<String, Object> session = ActionContext.getContext().getSession();
	User user = (User) session.get("webshop_user");

	if(user != null && (user.getRole().getTyp().equals("admin"))) {

		ProductManager productManager = new ProductManagerImpl();
		int productId = productManager.addProduct(name, Double.parseDouble(price), categoryId,
				details);

		if (productId > 0) {
			result = "success";
		}
	}

	return result;
}
 
開發者ID:mavogel,項目名稱:hska-vis-legacy,代碼行數:19,代碼來源:AddProductAction.java

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: loginInfo

import com.opensymphony.xwork2.ActionContext; //導入依賴的package包/類
public String loginInfo(){
	
	MyUserDetails myUserDetails=(MyUserDetails)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
	AcctUser user=accountManager.findUserByLoginName(myUserDetails.getUsername());
	//��֤servlet session����ʱrole������
	user.getRoleList();
	ActionContext actionContext = ActionContext.getContext();
    Map session = actionContext.getSession();
    session.put("user", user);
    
    for(AcctRole role:user.getRoleList()){
    	/*if(role.getName().equals("����Ա")){
    		isAdmin=true;
    		System.out.println("\n\n����Ա��¼\n\n");
    	}*/
    	
    	if(role.getId()==1){
    		session.put("isAdmin", true);
    	}
    	
    }
	return "success_form";
}
 
開發者ID:muzili90,項目名稱:SpringBBS,代碼行數:24,代碼來源:LoginAction.java

示例14: addUser

import com.opensymphony.xwork2.ActionContext; //導入依賴的package包/類
public String addUser(){
	String str =StringUtil.getfiletype(fileFileName);
	user.setSelfpic("\\logo"+str);
	userService.addUser(user);
	User u = userService.login(user.getUsername(), user.getPassword());
	String userFilename = PropertiesUtil.getFileProperties().getProperty("fileUrl")+u.getId();
	
	String logoFileName = userFilename+"/logo"+str; 
	try
	{
		FileUtils.forceMkdir(new File(userFilename));
		FileUtils.copyFile(file, new File(logoFileName));
		System.out.println(u.getId()+"q123123123123");
		String selfpic= "\\"+u.getId()+"\\logo"+str;
		u.setSelfpic(selfpic);
		u.setType(0);
		userService.updata(u);
		selfpic = PropertiesUtil.getFileProperties().getProperty("apacheUrl")+selfpic;
		u.setSelfpic(selfpic);
		ActionContext.getContext().getSession().put("u", u);
	} catch (IOException e)
	{
		e.printStackTrace();
	}
	return "userPicture";
}
 
開發者ID:AsJoy,項目名稱:huaban,代碼行數:27,代碼來源:UserAction.java

示例15: seeTestPaperUI

import com.opensymphony.xwork2.ActionContext; //導入依賴的package包/類
/** 查看習題 */
public String seeTestPaperUI() throws Exception{
	//準備數據--單選列表
	TestPaper testPaperFind=testPaperService.findById(testPaperId);
	List<TestQuestion> testQuestionList=new ArrayList<>(testPaperFind.getTestQuestions());
	List<Judgement> judgementList=new ArrayList<>();
	for(int i=0;i<testQuestionList.size();i++){
		if(testQuestionList.get(i).getJudgement()!=null){
			judgementList.add(testQuestionList.get(i).getJudgement());
		}
	}
	ActionContext.getContext().put("judgementList", judgementList);
	//準備數據--單選
	List<SingleChoice> singleChoiceList=new ArrayList<SingleChoice>();
	for(int i=0;i<testQuestionList.size();i++){
		if(testQuestionList.get(i).getSingleChoice()!=null){
			singleChoiceList.add(testQuestionList.get(i).getSingleChoice());
		}
	}
	ActionContext.getContext().put("singleChoiceList", singleChoiceList);
	//準備--testPaperId
	ActionContext.getContext().put("testPaperId", testPaperId);
	return "seeTestPaperUI";
}
 
開發者ID:lawlite19,項目名稱:SmartEducation,代碼行數:25,代碼來源:TeacherAction.java


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