org.springframework.ui.Model Java Examples

The following examples show how to use org.springframework.ui.Model. 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: ErrorController.java    From Spring-Security-Third-Edition with MIT License 6 votes vote down vote up
@ExceptionHandler(Throwable.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public ModelAndView exception(final Throwable throwable, final Model model) {
    logger.error("Exception during execution of SpringSecurity application", throwable);
    StringBuffer sb = new StringBuffer();
    sb.append("Exception during execution of Spring Security application!   ");

    sb.append((throwable != null && throwable.getMessage() != null ? throwable.getMessage() : "Unknown error"));

    if (throwable != null && throwable.getCause() != null) {
        sb.append(" root cause: ").append(throwable.getCause());
    }
    model.addAttribute("error", sb.toString());

    ModelAndView mav = new ModelAndView();
    mav.addObject("error", sb.toString());
    mav.setViewName("error");

    return mav;
}
 
Example #2
Source File: LoginController.java    From Shiro-Action with MIT License 6 votes vote down vote up
@OperationLog("激活注册账号")
@GetMapping("/active/{token}")
public String active(@PathVariable("token") String token, Model model) {
    User user = userService.selectByActiveCode(token);
    String msg;
    if (user == null) {
        msg = "请求异常, 激活地址不存在!";
    } else if ("1".equals(user.getStatus())) {
        msg = "用户已激活, 请勿重复激活!";
    } else {
        msg = "激活成功!";
        user.setStatus("1");
        userService.activeUserByUserId(user.getUserId());
    }
    model.addAttribute("msg", msg);
    return "active";
}
 
Example #3
Source File: ManageRegistrationProtocolsController.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@RequestMapping(method = RequestMethod.GET, value = "{registrationProtocol}")
public String edit(Model model, @PathVariable RegistrationProtocol registrationProtocol, @ModelAttribute RegistrationProtocolBean bean) {
    try {
        bean.setCode(registrationProtocol.getCode());
        bean.setDescription(registrationProtocol.getDescription());
        bean.setEnrolmentByStudentAllowed(registrationProtocol.getEnrolmentByStudentAllowed());
        bean.setPayGratuity(registrationProtocol.getPayGratuity());
        bean.setAllowsIDCard(registrationProtocol.getAllowsIDCard());
        bean.setOnlyAllowedDegreeEnrolment(registrationProtocol.getOnlyAllowedDegreeEnrolment());
        bean.setAlien(registrationProtocol.getAlien());
        bean.setExempted(registrationProtocol.getExempted());
        bean.setMobility(registrationProtocol.getMobility());
        bean.setMilitary(registrationProtocol.getMilitary());
        bean.setForOfficialMobilityReporting(registrationProtocol.getForOfficialMobilityReporting());
        bean.setAttemptAlmaMatterFromPrecedent(registrationProtocol.getAttemptAlmaMatterFromPrecedent());

        model.addAttribute("bean", bean);
        return view("edit");
    } catch (DomainException de) {
        model.addAttribute("error", de.getLocalizedMessage());
        return redirectHome();
    }
}
 
Example #4
Source File: UserHtmlController.java    From spring-boot-doma2-sample with Apache License 2.0 6 votes vote down vote up
/**
 * 詳細画面
 *
 * @param userId
 * @param model
 * @return
 */
@GetMapping("/show/{userId}")
public String showUser(@PathVariable Long userId, Model model) {
    // 1件取得する
    val user = userService.findById(userId);
    model.addAttribute("user", user);

    if (user.getUploadFile() != null) {
        // 添付ファイルを取得する
        val uploadFile = user.getUploadFile();

        // Base64デコードして解凍する
        val base64data = uploadFile.getContent().toBase64();
        val sb = new StringBuilder().append("data:image/png;base64,").append(base64data);

        model.addAttribute("image", sb.toString());
    }

    return "modules/users/users/show";
}
 
Example #5
Source File: LoginController.java    From roncoo-pay with Apache License 2.0 6 votes vote down vote up
/**
 * 函数功能说明 : 进入后台登陆页面.
 *
 * @参数: @return
 * @return String
 * @throws
 */
@RequestMapping("/login")
public String login(HttpServletRequest req, Model model) {

	String exceptionClassName = (String) req.getAttribute("shiroLoginFailure");
	String error = null;
	if (UnknownAccountException.class.getName().equals(exceptionClassName)) {
		error = "用户名/密码错误";
	} else if (IncorrectCredentialsException.class.getName().equals(exceptionClassName)) {
		error = "用户名/密码错误";
	} else if (PermissionException.class.getName().equals(exceptionClassName)) {
		error = "网络异常,请联系龙果管理员";
	} else if (exceptionClassName != null) {
		error = "错误提示:" + exceptionClassName;
	}
	model.addAttribute("message", error);
	return "system/login";
}
 
Example #6
Source File: PmsOperatorController.java    From roncoo-pay with Apache License 2.0 6 votes vote down vote up
/***
 * 重置操作员的密码(注意:不是修改当前登录操作员自己的密码) .
 * 
 * @return
 */
@RequiresPermissions("pms:operator:resetpwd")
@RequestMapping("/resetPwdUI")
public String resetOperatorPwdUI(HttpServletRequest req, Long id, Model model) {
	PmsOperator operator = pmsOperatorService.getDataById(id);
	if (operator == null) {
		return operateError("无法获取要重置的信息", model);
	}

	// 普通操作员没有修改超级管理员的权限
	if ("USER".equals(this.getPmsOperator().getType()) && "ADMIN".equals(operator.getType())) {
		return operateError("权限不足", model);
	}

	model.addAttribute("operator", operator);

	return "pms/pmsOperatorResetPwd";
}
 
Example #7
Source File: TrainingPage.java    From ExamStack with GNU General Public License v2.0 6 votes vote down vote up
@RequestMapping(value = "/student/training-history", method = RequestMethod.GET)
public String trainingHistory(Model model, HttpServletRequest request, @RequestParam(value="page",required=false,defaultValue="1") int page) {
	UserInfo userInfo = (UserInfo) SecurityContextHolder.getContext()
		    .getAuthentication()
		    .getPrincipal();
	Page<Training> pageModel = new Page<Training>();
	pageModel.setPageNo(page);
	pageModel.setPageSize(10);
	List<Training> trainingList = trainingService.getTrainingList(pageModel);
	Map<Integer,List<TrainingSectionProcess>> processMap = trainingService.getTrainingSectionProcessMapByUserId(userInfo.getUserid());
	String pageStr = PagingUtil.getPageBtnlink(page,
			pageModel.getTotalPage());
	model.addAttribute("trainingList", trainingList);
	model.addAttribute("processMap", processMap);
	model.addAttribute("pageStr", pageStr);
	return "training-history";
}
 
Example #8
Source File: NodeController.java    From shepher with Apache License 2.0 6 votes vote down vote up
/**
 * Updates node of the cluster.
 *
 * @param path
 * @param cluster
 * @param data
 * @param model
 * @return
 * @throws ShepherException
 */
@Auth(Jurisdiction.TEAM_MEMBER)
@RequestMapping(value = "/update", method = RequestMethod.POST)
public String update(@RequestParam("path") String path,
                     @PathVariable("cluster") String cluster,
                     @RequestParam(value = "data") String data,
                     @RequestParam(value = "srcPath", defaultValue = "/") String srcPath,
                     @RequestParam(value = "srcCluster", defaultValue = "") String srcCluster,
                     Model model)
        throws ShepherException {
    String tempData = data;
    if (!("/".equals(srcPath)) && !("".equals(srcCluster))) {
        tempData = nodeService.getData(srcCluster, srcPath);
    }

    User user = userHolder.getUser();
    if (ClusterUtil.isPublicCluster(cluster)) {
        nodeService.update(cluster, path, tempData, user.getName());
        return "redirect:/clusters/" + cluster + "/nodes?path=" + ParamUtils.encodeUrl(path);
    }

    long reviewId = reviewService.create(cluster, path, tempData, user, Action.UPDATE, ReviewStatus.NEW);
    return "redirect:/reviews/" + reviewId;
}
 
Example #9
Source File: DependStatisticPage.java    From fiery with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value = "/dependstatistic", method = RequestMethod.GET)
public String PerformancePage(Model model,
                              @RequestParam(value = "daytime", required = false) Integer daytime) {
    //校验参数
    if (daytime == null) {
        daytime = 0;
    }

    //list
    List<String> timelist = DateTimeHelper.getDateTimeListForPage(fieryConfig.getKeepdataday());
    model.addAttribute("datelist", timelist);
    model.addAttribute("datelist_selected", daytime);

    Map<String, Map<String, String>> performList = logApi.getPerformList(daytime);
    model.addAttribute("perfomancelist", performList);

    return "dependstatistic";
}
 
Example #10
Source File: AccountController.java    From Spring5Tutorial with GNU Lesser General Public License v3.0 6 votes vote down vote up
@GetMapping("reset_password")
public String resetPasswordForm(
        @RequestParam String name,
        @RequestParam String email,
        @RequestParam String token,
        Model model) {

    Optional<Account> optionalAcct = Optional.ofNullable(accountService.accountByNameEmail(name, email).getContent());
    
    if(optionalAcct.isPresent()) {
        Account acct = optionalAcct.get();
        if(acct.getPassword().equals(token)) {
            model.addAttribute("acct", acct);
            model.addAttribute("token", token);
            return RESET_PASSWORD_FORM_PATH;
        }
    }
    return REDIRECT_INDEX_PATH;
}
 
Example #11
Source File: ForgetController.java    From mySSM with MIT License 6 votes vote down vote up
@RequestMapping(value = "checkCode.do", method = {RequestMethod.POST, RequestMethod.GET})
public Map checkPhone(HttpServletRequest request, Model model,
                      @RequestParam String code, @RequestParam String token) {
    Map<String, Integer> map = new HashMap<>();
    String name = request.getParameter("name");
    if (!StringUtils.getInstance().isNullOrEmpty(name)) {
        request.getSession().setAttribute("name", name);
    }
    String checkCodeToken = (String) request.getSession().getAttribute("token");
    if (StringUtils.getInstance().isNullOrEmpty(checkCodeToken) || !checkCodeToken.equals(token)) {
        map.put("result", 0);
        return map;
    }
    //验证码错误
    if (!checkCodePhone(code, request)) {
        map.put("result", 0);
        return map;
    }
    map.put("result", 1);
    return map;
}
 
Example #12
Source File: BrownFieldSiteController.java    From Spring-Microservices with MIT License 6 votes vote down vote up
@RequestMapping(value="/confirm", method=RequestMethod.POST)
 public String ConfirmBooking(@ModelAttribute UIData uiData, Model model) {
  	Flight flight= uiData.getSelectedFlight();
BookingRecord booking = new BookingRecord(flight.getFlightNumber(),flight.getOrigin(),
		  flight.getDestination(), flight.getFlightDate(),null,
		  flight.getFares().getFare());
Set<Passenger> passengers = new HashSet<Passenger>();
Passenger pax = uiData.getPassenger();
pax.setBookingRecord(booking);
passengers.add(uiData.getPassenger());
		booking.setPassengers(passengers);
long bookingId =0;
try { 
	//long bookingId = bookingClient.postForObject("http://book-service/booking/create", booking, long.class); 
	 bookingId = bookingClient.postForObject("http://book-apigateway/api/booking/create", booking, long.class); 
	logger.info("Booking created "+ bookingId);
}catch (Exception e){
	logger.error("BOOKING SERVICE NOT AVAILABLE...!!!");
}
model.addAttribute("message", "Your Booking is confirmed. Reference Number is "+ bookingId);
return "confirm";
 }
 
Example #13
Source File: UserController.java    From SOFRepos with MIT License 6 votes vote down vote up
@RequestMapping(value = "/user", params = "add", method = RequestMethod.POST)
public String postAddUser(@ModelAttribute @Valid User user,
		BindingResult result, Model model) {
	System.out.println("result->has errors:-"+result.hasErrors()+" "+result);

	if (result.hasErrors()) {
		System.out.println(result.getAllErrors().toString());

		ArrayList<Role> roles = new ArrayList<Role>();
		roles.add(Role.ADMIN);
		roles.add(Role.HEAD_OF_DEPARTMENT);
		model.addAttribute("roles", roles);
		return "user/add";
	} else {
		System.out.println("Inside postAddUser");
		user = userService.save(user);
		return "redirect:user?id=" + user.getId();
	}

}
 
Example #14
Source File: ModelArgumentResolver.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Override
public Object resolveArgumentValue(
		MethodParameter parameter, BindingContext context, ServerWebExchange exchange) {

	Class<?> type = parameter.getParameterType();
	if (Model.class.isAssignableFrom(type)) {
		return context.getModel();
	}
	else if (Map.class.isAssignableFrom(type)) {
		return context.getModel().asMap();
	}
	else {
		// Should never happen..
		throw new IllegalStateException("Unexpected method parameter type: " + type);
	}
}
 
Example #15
Source File: CmsController.java    From hermes with Apache License 2.0 6 votes vote down vote up
@RequestMapping("help-center/{cid}")
public String helpCenterArticleCategory(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer size, @PathVariable String cid, Model model) {
	List<Order> orders = new ArrayList<Order>();
	orders.add(new Order(Direction.ASC, "order"));
	orders.add(new Order(Direction.DESC, "updateTime"));
	Pageable pageable = new PageRequest(page, size, new Sort(orders));
	Page<Article> dataBox = articleService.find(cid, pageable);
	if (dataBox.getContent().size() == 1) {
		return "redirect:/help-center/" + cid + "/" + dataBox.getContent().get(0).getId();
	} else {
		List<ArticleCategory> articleCategorys = articleCategoryRepository.findByLevel("二级");
		for (ArticleCategory a : articleCategorys) {
			if (OTHER_KIND_LEVEL.equals(a.getCode())) {
				articleCategorys.remove(a);
				break;
			}
		}
		model.addAttribute("nav",HomeNav.HELP );
		model.addAttribute("second", articleCategorys);
		model.addAttribute("sel", articleCategoryRepository.findOne(cid));
		model.addAttribute("aeli", dataBox);
		return "cms/template_li";
	}
}
 
Example #16
Source File: CodeCategoryHtmlController.java    From spring-boot-doma2-sample with Apache License 2.0 6 votes vote down vote up
/**
 * 一覧画面 初期表示
 *
 * @param model
 * @return
 */
@GetMapping("/find")
public String findCodeCategory(@ModelAttribute("searchCodeCategoryForm") SearchCodeCategoryForm form, Model model) {
    // 入力値から検索条件を作成する
    val criteria = modelMapper.map(form, CodeCategoryCriteria.class);

    // 10件区切りで取得する
    val pages = codeCategoryService.findAll(criteria, form);

    // 画面に検索結果を渡す
    model.addAttribute("pages", pages);

    // カテゴリ分類一覧
    val codeCategories = codeHelper.getCodeCategories();
    model.addAttribute("codeCategories", codeCategories);

    return "modules/system/code_categories/find";
}
 
Example #17
Source File: ServerSchedulerController.java    From spring-batch-lightmin with Apache License 2.0 6 votes vote down vote up
@GetMapping(value = "/server-scheduler-configuration", params = {"init-add-configuration"})
public void initSchedulerConfigurationAdd(
        final Model model,
        @RequestParam(name = "application") final String applicationName) {

    final ServerSchedulerConfigurationModel configuration;

    if (model.containsAttribute("schedulerConfiguration")) {
        configuration = (ServerSchedulerConfigurationModel) model.asMap().get("schedulerConfiguration");
    } else {
        configuration = new ServerSchedulerConfigurationModel();
    }
    configuration.setApplicationName(applicationName);
    final ApplicationContextModel applicationContextModel = this.getApplicationContextModel(applicationName);

    model.addAttribute("schedulerConfiguration", configuration);
    model.addAttribute("modificationType", new ModificationTypeModel(ModificationTypeModel.ModificationType.ADD));
    model.addAttribute("applicationContextModel", applicationContextModel);
    model.addAttribute("schedulerStatus", ServerSchedulerConfigurationStatusModel.ServerSchedulerConfigurationStatusType.values());
    model.addAttribute("booleanSelector", BooleanModel.values());
}
 
Example #18
Source File: StatisticController.java    From ACManager with GNU General Public License v3.0 5 votes vote down vote up
@RequestMapping("/showTable")
public String showTable(Model model) {
    List<User> users = userService.allNormalNotNullUsers();
    model.addAttribute("users", users);
    model.addAttribute("cfInfoMap", cfbcService.getCFUserInfoMap());
    model.addAttribute("bcInfoMap", cfbcService.getBCUserInfoMap());
    model.addAttribute("ratingMap",
            ratingService.getRatingMap(RatingRecord.Scope.Global, 1, RatingRecord.Type.Personal));
    model.addAttribute("playcntMap",
            ratingService.getPlayCnt(RatingRecord.Scope.Global, 1, RatingRecord.Type.Personal));
    model.addAttribute("playDuration",
            ratingService.getPlayDuration(RatingRecord.Scope.Global, 1, RatingRecord.Type.Personal));
    return "tablefile";
}
 
Example #19
Source File: PartyController.java    From lemon with Apache License 2.0 5 votes vote down vote up
/**
 * 新增人员.
 *
 *
 * @param parentId Long
 * @param userId String
 * @param model Model
 * @return String
 * @throws Exception ex
 */
@RequestMapping("index-save")
public String indexSave(
        @RequestParam(value = "parentId", required = false) Long parentId,
        @RequestParam("userId") String userId, Model model)
        throws Exception {
    if (parentId == null) {
        parentId = partyService.getDefaultRootPartyEntityId();
    }

    // parent
    PartyEntity parent = partyEntityManager.get(parentId);
    model.addAttribute("parent", parent);

    // child
    PartyEntity child = partyEntityManager.findUnique(
            "from PartyEntity where ref=? and partyType.type=1", userId);

    if (child == null) {
        // user
        UserDTO userDto = userClient.findById(userId, "1");
        child = new PartyEntity();
        child.setCode(userDto.getUsername());
        child.setName(userDto.getDisplayName());
        child.setRef(userId);
        partyEntityManager.save(child);
    }

    // struct
    PartyStruct partyStruct = new PartyStruct();
    partyStruct.setParentEntity(parent);
    partyStruct.setChildEntity(child);
    partyStruct.setPartyStructType(partyStructTypeManager.findUniqueBy(
            "type", "struct"));
    partyStructManager.save(partyStruct);

    return "redirect:/party/index.do?partyEntityId=" + parentId;
}
 
Example #20
Source File: SensitiveWordAdminController.java    From pybbs with GNU Affero General Public License v3.0 5 votes vote down vote up
@RequiresPermissions("sensitive_word:list")
@GetMapping("/list")
public String list(@RequestParam(defaultValue = "1") Integer pageNo, String word, Model model) {
    model.addAttribute("page", sensitiveWordService.page(pageNo, word));
    model.addAttribute("word", word);
    return "admin/sensitive_word/list";
}
 
Example #21
Source File: GlobalExceptionHandler.java    From Spring-Boot-Book with Apache License 2.0 5 votes vote down vote up
/**
 * 业务层需要自己声明异常的情况
 */
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ExceptionHandler(ServiceException.class)
public String handleServiceException(ServiceException e, Model model) {
    logger.error("业务逻辑异常", e);
    String message = "【业务逻辑异常】" + e.getMessage();
    model.addAttribute("message", message);
    return viewName;
}
 
Example #22
Source File: PeopleController.java    From scoold with Apache License 2.0 5 votes vote down vote up
@GetMapping
public String get(@RequestParam(required = false, defaultValue = Config._TIMESTAMP) String sortby,
		@RequestParam(required = false, defaultValue = "*") String q, HttpServletRequest req, Model model) {
	if (!utils.isDefaultSpacePublic() && !utils.isAuthenticated(req)) {
		return "redirect:" + SIGNINLINK + "?returnto=" + PEOPLELINK;
	}
	Profile authUser = utils.getAuthUser(req);
	Pager itemcount = utils.getPager("page", req);
	itemcount.setSortby(sortby);
	// [space query filter] + original query string
	String qs = utils.sanitizeQueryString(q, req);
	if (req.getParameter("bulkedit") != null && utils.isAdmin(authUser)) {
		qs = q;
	} else {
		qs = qs.replaceAll("properties\\.space:", "properties.spaces:");
	}

	List<Profile> userlist = utils.getParaClient().findQuery(Utils.type(Profile.class), qs, itemcount);
	model.addAttribute("path", "people.vm");
	model.addAttribute("title", utils.getLang(req).get("people.title"));
	model.addAttribute("peopleSelected", "navbtn-hover");
	model.addAttribute("itemcount", itemcount);
	model.addAttribute("userlist", userlist);
	if (req.getParameter("bulkedit") != null && utils.isAdmin(authUser)) {
		List<ParaObject> spaces = utils.getParaClient().findQuery("scooldspace", "*", new Pager(Config.DEFAULT_LIMIT));
		model.addAttribute("spaces", spaces);
	}
	return "base";
}
 
Example #23
Source File: ExamPageTeacher.java    From ExamStack with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 学员试卷
 * @param model
 * @param request
 * @param examhistoryId
 * @return
 */
@RequestMapping(value = "/teacher/exam/student-answer-sheet/{histId}", method = RequestMethod.GET)
private String studentAnswerSheetPage(Model model, HttpServletRequest request, @PathVariable int histId) {
	
	ExamHistory history = examService.getUserExamHistListByHistId(histId);
	int examPaperId = history.getExamPaperId();
	
	String strUrl = "http://" + request.getServerName() // 服务器地址
			+ ":" + request.getServerPort() + "/";
	
	ExamPaper examPaper = examPaperService.getExamPaperById(examPaperId);
	StringBuilder sb = new StringBuilder();
	if(examPaper.getContent() != null && !examPaper.getContent().equals("")){
		Gson gson = new Gson();
		String content = examPaper.getContent();
		List<QuestionQueryResult> questionList = gson.fromJson(content, new TypeToken<List<QuestionQueryResult>>(){}.getType());
		
		for(QuestionQueryResult question : questionList){
			QuestionAdapter adapter = new QuestionAdapter(question,strUrl);
			sb.append(adapter.getStringFromXML());
		}
	}
	
	model.addAttribute("htmlStr", sb);
	model.addAttribute("exampaperid", examPaperId);
	model.addAttribute("examHistoryId", history.getHistId());
	model.addAttribute("exampapername", examPaper.getName());
	model.addAttribute("examId", history.getExamId());
	return "student-answer-sheet";
}
 
Example #24
Source File: ModelFactoryTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void modelAttributeMethod() throws Exception {
	ModelFactory modelFactory = createModelFactory("modelAttr", Model.class);
	ModelAndViewContainer mavContainer = new ModelAndViewContainer();
	modelFactory.initModel(this.webRequest, mavContainer, this.handleMethod);

	assertEquals(Boolean.TRUE, mavContainer.getModel().get("modelAttr"));
}
 
Example #25
Source File: BrownFieldSiteController.java    From Spring-Microservices with MIT License 5 votes vote down vote up
@RequestMapping(value="/book/{flightNumber}/{origin}/{destination}/{flightDate}/{fare}", method=RequestMethod.GET)
public String bookQuery(@PathVariable String flightNumber, 
  @PathVariable String origin, 
  @PathVariable String destination, 
  @PathVariable String flightDate, 
  @PathVariable String fare, 
  Model model) {
		UIData uiData = new UIData();
		Flight flight = new Flight(flightNumber, origin,destination,flightDate,new Fares(fare,"AED"));
		uiData.setSelectedFlight(flight);
		uiData.setPassenger(new Passenger());
 model.addAttribute("uidata",uiData);
    return "book"; 
}
 
Example #26
Source File: ClusterConfigController.java    From kafka-webview with MIT License 5 votes vote down vote up
/**
 * GET Displays create cluster form.
 */
@RequestMapping(path = "/create", method = RequestMethod.GET)
public String createClusterForm(final ClusterForm clusterForm, final Model model) {
    // Setup breadcrumbs
    setupBreadCrumbs(model, "Create", "/configuration/cluster/create");

    return "configuration/cluster/create";
}
 
Example #27
Source File: RenderController.java    From OneBlog with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 分类列表
 *
 * @param typeId
 * @param model
 * @return
 */
@GetMapping("/type/{typeId}")
@BussinessLog(value = "进入文章分类[{1}]列表页", platform = PlatformEnum.WEB)
public ModelAndView type(@PathVariable("typeId") Long typeId, Model model) {
    ArticleConditionVO vo = new ArticleConditionVO();
    vo.setTypeId(typeId);
    model.addAttribute("url", "type/" + typeId);
    loadIndexPage(vo, model);

    return ResultUtil.view(INDEX_URL);
}
 
Example #28
Source File: AppManageController.java    From cachecloud with Apache License 2.0 5 votes vote down vote up
/**
 * 开始水平扩容
 * @param sourceId 源实例ID
 * @param targetId 目标实例ID
 * @param startSlot 开始slot
 * @param endSlot 结束slot
 * @param appId 应用id
 * @param appAuditId 审批id
 * @return
 */
@RequestMapping(value = "/startHorizontalScale")
public ModelAndView doStartHorizontalScale(HttpServletRequest request, HttpServletResponse response, Model model,
		long sourceId, long targetId, int startSlot, int endSlot, long appId, long appAuditId, int migrateType) {
	AppUser appUser = getUserInfo(request);
	logger.warn("user {} horizontalScaleApply appId {} appAuditId {} sourceId {} targetId {} startSlot {} endSlot {}",
			appUser.getName(), appId, appAuditId, sourceId, targetId, startSlot, endSlot);
	HorizontalResult horizontalResult = appDeployCenter.startHorizontal(appId, appAuditId, sourceId, targetId,
			startSlot, endSlot, migrateType);
       model.addAttribute("status", horizontalResult.getStatus());
	model.addAttribute("message", horizontalResult.getMessage());
	return new ModelAndView("");
}
 
Example #29
Source File: MemberController.java    From javamoney-examples with Apache License 2.0 5 votes vote down vote up
@RequestMapping(method=RequestMethod.POST)
public String registerNewMember(@Valid @ModelAttribute("newMember") Member newMember, BindingResult result, Model model)
{
    if (!result.hasErrors()) {
        memberDao.register(newMember);
        return "redirect:/";
    }
    else {
        model.addAttribute("members", memberDao.findAllOrderedByName());
        return "index";
    }
}
 
Example #30
Source File: SystemController.java    From Guns with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 系统硬件信息页面
 *
 * @author fengshuonan
 * @Date 2018/12/24 22:43
 */
@RequestMapping("/systemInfo")
public String systemInfo(Model model) {

    SystemHardwareInfo systemHardwareInfo = new SystemHardwareInfo();
    systemHardwareInfo.copyTo();

    model.addAttribute("server", systemHardwareInfo);

    return "/modular/frame/systemInfo.html";
}