org.apache.struts2.convention.annotation.Result Java Examples
The following examples show how to use
org.apache.struts2.convention.annotation.Result.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LoginAction.java From java-course-ee with MIT License | 6 votes |
@Override @Action(value = "login-action", results = { @Result(name = "input", location = "login.jsp"), @Result(name = "success", location = "success.jsp"), @Result(name = "failure", location = "failure.jsp") }) @Validations(requiredStrings = { @RequiredStringValidator(fieldName = "loginBean.username", type = ValidatorType.FIELD, key = "username_required"), @RequiredStringValidator(fieldName = "loginBean.password", type = ValidatorType.FIELD, key = "password_required") }) public String execute() throws Exception { if ("gemini".equals(loginBean.getUsername()) && "systems".equals(loginBean.getPassword())) { return "success"; } else { return "failure"; } }
Example #2
Source File: IndexAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 6 votes |
@Action(value="toOrder", results={@Result(name="orderUI", location=ViewLocation.View_ROOT+ "hotel.jsp")}) public String toOrder() throws Exception{ //TODO 跳转到选择团购券的页面 Customer customer = (Customer)session.get(Const.CUSTOMER); List<Grouppurchasevoucher> gps = grouppurchasevoucherService.getByCust(customer); //把数据封装成Map Map<Roomtype, List<Grouppurchasevoucher>> rgMap = new LinkedHashMap<Roomtype, List<Grouppurchasevoucher>>(); for(Grouppurchasevoucher gp : gps){ if(!rgMap.containsKey(gp.getRoomtype())){ List<Grouppurchasevoucher> grps = new LinkedList<Grouppurchasevoucher>(); rgMap.put(gp.getRoomtype(), grps); } rgMap.get(gp.getRoomtype()).add(gp); } request.setAttribute("rgMap", rgMap); return "orderUI"; }
Example #3
Source File: OrderAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 6 votes |
@Action(value = "toFifth", results = { @Result(name = "stepFifthUI", location = ViewLocation.View_ROOT + "orderstep4.jsp") }) public String toFifth() throws Exception{ //未支付押金订单生成 Mrcodeorder order = null; if((order=createOrder())!=null){ for(Password p : order.getPasswords()){ String msg = "【码团网】"+p.getContactors().getName()+"您好!您已下单成功,日期:"+p.getEstimatedTime().toString().substring(0,10)+ ",房间:"+p.getRoom().getRoomNumber()+"。酒店正为您办理入住手续,至酒店确认本人身份后,凭房间密码"+p.getPassword()+"即可入住。"; System.out.println("message:"+msg); JSONObject o = JSONObject.fromObject(MessageSend.sendSms(msg, p.getContactors().getPhoneNumber())); System.out.println("result:"+o); } request.setAttribute("msg", "已完成房间入住手续,请至酒店前台核对身份证,并支付押金,即可入住,谢谢!"); } return "stepFifthUI"; }
Example #4
Source File: OrderAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 6 votes |
@Action(value = "toThird", results = { @Result(name = "stepThirdUI", location = ViewLocation.View_ROOT + "orderstep2.jsp") }) public String toThird() throws Exception{ //TODO 跳转至第三步,订单展示及确认页面 Customer customer = (Customer)session.get(Const.CUSTOMER); String ids = getParameter("ids"); List<Room> rooms = roomService.getByIds(ids); List<Contactors> contactors = contactorsService.getContactorsByCustomerId(customer); Integer days = (Integer)session.get("days"); Roomtype roomtype = (Roomtype)session.get("roomtype"); //需要使用的团购券,放入session Integer needVouchers = days*rooms.size(); pageBean.setPageSize(needVouchers); List<Grouppurchasevoucher> vouchers = grouppurchasevoucherService.getByType(customer, roomtype, pageBean); session.put("vouchers", vouchers); request.setAttribute("total", needVouchers*vouchers.get(0).getPrice()); session.put("rooms", rooms); request.setAttribute("contactors", contactors); return "stepThirdUI"; }
Example #5
Source File: UserAction.java From Resource with GNU General Public License v3.0 | 5 votes |
@Action(value = "login", results = { @Result(name = "success", location = "/success.jsp", params = {"resultJson", "resultJson"}), @Result(name = "error", location = "/error.jsp")}) public String execute() throws Exception { HttpServletResponse response = ServletActionContext.getResponse(); HttpServletRequest request = ServletActionContext.getRequest(); JSONObject result = new JSONObject(); User user = userService.getByName(username); result.put("user", user); if (user != null && user.getUser_name().equals(username) && user.getPassword().equals(password)) { result.put("message", "登录成功"); result.put("status", "true"); resultJson = result.toString(); request.setAttribute("resultJson", resultJson); writeResponseData(request, response, result); return "success"; } result.put("message", "登录失败"); result.put("status", "false"); resultJson = result.toString(); writeResponseData(request, response, result); return "error"; }
Example #6
Source File: LoginAction.java From java-course-ee with MIT License | 5 votes |
@Override @Action(value = "login-screen", results = { @Result(name = "input", location = "login.jsp") }) public String input() throws Exception { return "input"; }
Example #7
Source File: SysRoleAction.java From EasyEE with MIT License | 5 votes |
@Override @Action(value="page",results={ @Result(location="/WEB-INF/content/main/sys/sysRole.jsp") }) public String execute() throws Exception { return SUCCESS; }
Example #8
Source File: SysOperationPermissionAction.java From EasyEE with MIT License | 5 votes |
@Override @Action(value="page",results={ @Result(location="/WEB-INF/content/main/sys/sysOperationPermission.jsp") }) public String execute() throws Exception { return SUCCESS; }
Example #9
Source File: SysMenuPermissionAction.java From EasyEE with MIT License | 5 votes |
@Override @Action(value="page",results={ @Result(location="/WEB-INF/content/main/sys/sysMenuPermission.jsp") }) public String execute() throws Exception { return SUCCESS; }
Example #10
Source File: SysLogAction.java From EasyEE with MIT License | 5 votes |
/** * 分页查询 * * @return * @throws Exception */ @Action(value="page",results={ @Result(location="/WEB-INF/content/main/sys/sysLog.jsp") }) public String execute() { return SUCCESS; }
Example #11
Source File: SysUserAction.java From EasyEE with MIT License | 5 votes |
@Override @Action(value="page",results={ @Result(location="/WEB-INF/content/main/sys/sysUser.jsp") }) public String execute() throws Exception { return SUCCESS; }
Example #12
Source File: DeptAction.java From EasyEE with MIT License | 5 votes |
/** * 转向显示页面 * @return */ @Action(value="page",results={ @Result(location="/WEB-INF/content/main/hr/Dept.jsp") }) public String page(){ return SUCCESS; }
Example #13
Source File: IndexAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 5 votes |
@Action(value="profile", results={@Result(name="profile", location=ViewLocation.View_ROOT+ "quit.jsp")}) public String profile() throws Exception{ Customer customer = (Customer)session.get(Const.CUSTOMER); Customer cus = (Customer) session.get("customer"); request.setAttribute("userName", cus.getUserName()); request.setAttribute("phoneNumber",cus.getPhoneNumber()); return "profile"; }
Example #14
Source File: CateRecommendAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 5 votes |
@Action(value="toCateRecommend", results={@Result(name="restaurant_business_high", location=ViewLocation.View_ROOT+ "restaurant_business_high.jsp"), @Result(name="restaurant_business_low", location=ViewLocation.View_ROOT+ "restaurant_business_low.jsp"), @Result(name="restaurant_visitor_high", location=ViewLocation.View_ROOT+ "restaurant_visitor_high.jsp"), @Result(name="restaurant_visitor_low", location=ViewLocation.View_ROOT+ "restaurant_visitor_low.jsp")}) public String toCateRecommend() throws Exception{ //TODO 跳转到美食推荐的页面 Customer cus = (Customer) session.get("customer"); int cusType = cus.getCusType(); int shopLevel = cus.getShopLevel(); int result = Recommend.recomendInt(cusType,shopLevel); System.out.println("result" + result); if (result == 1) return "restaurant_business_high"; else if (result == 2) return "restaurant_business_low"; else if (result == 3) return "restaurant_visitor_high"; else if (result == 4) return "restaurant_visitor_low"; return "restaurant_visitor_low"; }
Example #15
Source File: visitRecommendAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 5 votes |
@Action(value="toVisitRecommend", results={@Result(name="visiting_business_high", location=ViewLocation.View_ROOT+ "visiting_business_high.jsp"), @Result(name="visiting_business_low", location=ViewLocation.View_ROOT+ "visiting_business_low.jsp"), @Result(name="visiting_visitor_high", location=ViewLocation.View_ROOT+ "visiting_visitor_high.jsp"), @Result(name="visiting_visitor_low", location=ViewLocation.View_ROOT+ "visiting_visitor_low.jsp")}) public String toVisitRecommend() throws Exception{ //TODO 跳转到交通推荐的页面 Customer cus = (Customer) session.get("customer"); int cusType = cus.getCusType(); int shopLevel = cus.getShopLevel(); int result = Recommend.recomendInt(cusType,shopLevel); System.out.println("result" + result); if (result == 1) return "visiting_business_high"; else if (result == 2) return "visiting_business_low"; else if (result == 3) return "visiting_visitor_high"; else if (result == 4) return "visiting_visitor_low"; return "traffic_visitor_low"; }
Example #16
Source File: OrderAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 5 votes |
@Action(value = "toFourth", results = { @Result(name = "stepFourthUI", location = ViewLocation.View_ROOT + "orderstep3.jsp") }) public String toFourth() throws Exception{ //支付押金,跳转至付款页面 Mrcodeorder order = null; if((order=createOrder())!=null){ request.setAttribute("order", order); }else { request.setAttribute("msg", "入住订单生成失败,请重新操作"); } return "stepFourthUI"; }
Example #17
Source File: LoginAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 5 votes |
/** * 首页 * @return */ @Action(value = "toIndex", results = { @Result(name = "index", location = "/WEB-INF/" +"index.jsp")}) public String index() throws Exception{ return "index"; }
Example #18
Source File: RandomAction.java From sdudoc with MIT License | 5 votes |
@Action(value = "randomImage", results = { @Result(name = "success", type = "stream", params = { "contentType", "image/jpeg", "inputStream", "inputStream" }) }) public String randomImage() throws Exception { RandomNumUtil ranUtil = RandomNumUtil.Instance(); this.setInputStream(ranUtil.getImage());// 取得带有随机字符串的图片 session.put(Constants.RANDOM, ranUtil.getString());// 取得随机字符串放入HttpSession return SUCCESS; }
Example #19
Source File: RoomManageAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 5 votes |
@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"; }
Example #20
Source File: TrafficRecommendAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 5 votes |
@Action(value="toTrafficRecommend", results={@Result(name="traffic_business_high", location=ViewLocation.View_ROOT+ "traffic_business_high.jsp"), @Result(name="traffic_business_low", location=ViewLocation.View_ROOT+ "traffic_business_low.jsp"), @Result(name="traffic_visitor_high", location=ViewLocation.View_ROOT+ "traffic_visitor_high.jsp"), @Result(name="traffic_visitor_low", location=ViewLocation.View_ROOT+ "traffic_visitor_low.jsp")}) public String toTrafficRecommend() throws Exception{ //TODO 跳转到交通推荐的页面 Customer cus = (Customer) session.get("customer"); int cusType = cus.getCusType(); int shopLevel = cus.getShopLevel(); int result = Recommend.recomendInt(cusType,shopLevel); System.out.println("result" + result); if (result == 1) return "traffic_business_high"; else if (result == 2) return "traffic_business_low"; else if (result == 3) return "traffic_visitor_high"; else if (result == 4) return "traffic_visitor_low"; return "traffic_visitor_low"; }
Example #21
Source File: LoginAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 5 votes |
@Action(value = "toLogin", results = { @Result(name = "loginUI", location = ViewLocation.View_ROOT + "login.jsp") }) public String toLogin() throws Exception{ if(ActionContext.getContext().get("msg")!=null) request.setAttribute("msg", ActionContext.getContext().get("msg")); return "loginUI"; }
Example #22
Source File: OrderAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 5 votes |
@Action(value = "toFirst", results = { @Result(name = "stepFirstUI", location = ViewLocation.View_ROOT + "orderstep0.jsp") }) public String toFirst() throws Exception{ //跳转至入住第一步,选择日期页面 Customer customer = (Customer)session.get(Const.CUSTOMER); //获得房间类型 Integer typeId = getIntParameter("typeId", -1); Integer validCount = grouppurchasevoucherService.getTypeCount(customer, typeId); dataMap.put("id", typeId); Roomtype roomtype = roomtypeService.findUniqueByHql("from Roomtype r left join fetch r.hotel where r.id=:id", dataMap); session.put("roomtype", roomtype); //选择的房间类型 session.put("validCount", validCount); //团购券数量 return "stepFirstUI"; }
Example #23
Source File: LoginAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 5 votes |
/** * 动态登陆页面 * @return */ @Action(value = "toLoginPhone", results = { @Result(name = "toLoginPhone", location = ViewLocation.View_ROOT +"login_phone.jsp")}) public String toLoginPhone() throws Exception{ return "toLoginPhone"; }
Example #24
Source File: PerfectInformationAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 5 votes |
@Action(value = "perfectInformation", results = { @Result(name = "perfectInformation", location = ViewLocation.View_ROOT + "information.jsp") }) public String perfectInformation() throws Exception{ if(ActionContext.getContext().get("msg")!=null) request.setAttribute("msg", ActionContext.getContext().get("msg")); Customer cus = (Customer) session.get("customer"); request.setAttribute("userName", cus.getUserName()); request.setAttribute("phoneNumber",cus.getPhoneNumber()); request.setAttribute("identityCard",cus.getIdentityCard()); request.setAttribute("truename",cus.getTrueName()); return "perfectInformation"; }
Example #25
Source File: AddLinkmanAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 5 votes |
@Action(value = "toAddLinkman", results = { @Result(name = "addLinkmanUI", location = ViewLocation.View_ROOT + "add_friends.jsp") }) public String toAddLinkman() throws Exception{ if(ActionContext.getContext().get("msg")!=null) request.setAttribute("msg", ActionContext.getContext().get("msg")); Customer cus = (Customer) session.get("customer"); List<Contactors> contsList= contactorsService.getContactorsByCustomerIds(cus); request.setAttribute("contsList", contsList); return "addLinkmanUI"; }
Example #26
Source File: AddLinkmanAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 5 votes |
@Action (value = "delLinkman" ,results = {@Result(name = "delLinkman" , type = TYPE_REDIRECT_ACTION,location= "toAddLinkman" )}) public String delLinkman() throws Exception { int i = getIntParameter("id",-1); Contactors cont = contactorsService.getById(i); // isSelf = 2 联系人被删除 // isSelf = 1 本人,但不显示在联系人列表 // isSelf = 0 可用联系人 cont.setIsSelf(2); contactorsService.update(cont); return "delLinkman"; }
Example #27
Source File: AddLinkmanAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 5 votes |
@Action (value= "addLinkman" , results = {@Result(name ="toAddLinkman", type = TYPE_REDIRECT_ACTION,location= "toAddLinkman" )}) public String addLinkman() throws Exception { String userName = getParameter("userName"); String phoneNumber = getParameter("phoneNumber"); String identityCard = getParameter("identityCard"); System.out.println(userName + phoneNumber + identityCard); Contactors cont = new Contactors(); Customer cus = (Customer)session.get("customer"); if (contactorsService.isExist(identityCard, cus)) { return "toAddLinkman"; } cont.setCustomer(cus); cont.setIdentityCard(identityCard); cont.setName(userName); cont.setPhoneNumber(phoneNumber); cont.setIsSelf(0); contactorsService.save(cont); return "toAddLinkman"; }
Example #28
Source File: IndexAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 4 votes |
@Action(value="toAboutus", results={@Result(name="aboutus", location=ViewLocation.View_ROOT+ "aboutus.jsp")}) public String toAboutus() throws Exception{ return "aboutus"; }
Example #29
Source File: PerfectInformationAction.java From xmu-2016-MrCode with GNU General Public License v2.0 | 4 votes |
@Action(value = "addInformation", results = { @Result(name = "toIndex", location = "/WEB-INF/" +"index.jsp") }) public String addInformation() throws Exception{ if(ActionContext.getContext().get("msg")!=null) request.setAttribute("msg", ActionContext.getContext().get("msg")); Customer cus = (Customer) session.get("customer"); /* * 图片识别身份证功能,接口bug * MultiPartRequestWrapper multipartRequest = (MultiPartRequestWrapper)request; if ( multipartRequest.getFiles("imageInput") != null) { File imgFile = multipartRequest.getFiles("imageInput")[0]; String imgFileName = multipartRequest.getFileNames("imageInput")[0]; if(imgFile.exists()){ String path1 = WebApplication.getContextPath()+"\\resource\\upload"; System.out.println(path1); String img = ImageUtils.save(imgFile, path1, imgFileName, UUID.randomUUID().toString(), null); System.out.println(img); int x=path1.indexOf("upload"); String path = path1.substring(x-1); path = path.replaceAll("\\\\", "/"); System.out.println(path+"/"+img); cus.setIdentityPic(path+"/"+img); String winPath = path1 + "\\" + img; System.out.println("windows" + winPath); String linuxPath = ("path1" + "\\" + img).replaceAll("\\\\", "/"); System.out.println(linuxPath); String[] strs = Identification.IdCard(winPath); // String[] strs = Identification.IdCard(linuxPath); System.out.println(strs[0] + "--" + strs[1]); System.out.println(cus.getTrueName()); cus.setIdentityCard(strs[1]); cus.setTrueName(strs[0]); cus.setPerfectInformation(1); customerService.update(cus); System.out.println(cus.getTrueName()); } } else */ if(getParameter("identityCard") != null && getParameter("identityCard")!=""){ String truename = getParameter("truename"); String identityCard = getParameter("identityCard"); System.out.println(truename + "--" + identityCard); cus.setIdentityCard(identityCard); cus.setTrueName(truename); cus.setPerfectInformation(1); customerService.update(cus); } return "toIndex"; }
Example #30
Source File: ForwardAction.java From EasyEE with MIT License | 4 votes |
@Action(value="/toLogin",results={ @Result(location="/WEB-INF/content/login.jsp") }) public String toLogin() { return SUCCESS; }