Java 类org.springframework.ui.Model 实例源码

项目:Spring-Security-Third-Edition    文件:ErrorController.java   
@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;
}
项目:esup-sgc    文件:ManagerCardController.java   
@PreAuthorize("hasRole('ROLE_MANAGER') or hasRole('ROLE_LIVREUR')")
@RequestMapping(value="/multiDelivery", method=RequestMethod.POST)
@Transactional
public String multiDelivery(@RequestParam List<Long> listeIds, Model uiModel) {

    for(Long id : listeIds){
        try {
            Card card = Card.findCard(id);
            card.setDeliveredDate(new Date());
            card.merge();
        } catch (Exception e) {
            log.info("La carte avec l'id suivant n'a pas été marquée comme livrée : " + id, e);
        }
    }
    uiModel.asMap().clear();
    return "redirect:/manager/";
}
项目:wangmarket    文件:TemplateController.java   
/**
 * 通过res.weiunity.com的CDN获取制定的模版,远程获取模版文件,将当前网站应用此模版。
 * <br/>模版文件包含模版页面,模版变量、栏目
 */
@RequestMapping("remoteImportTemplate")
@ResponseBody
public BaseVO remoteImportTemplate(HttpServletRequest request, Model model,
        @RequestParam(value = "templateName", required = false , defaultValue="") String templateName){
    if(templateName.length() == 0){
        return error("请选择要远程获取的模版");
    }

    HttpUtil http = new HttpUtil(HttpUtil.UTF8);
    HttpResponse hr = http.get(G.RES_CDN_DOMAIN+"template/"+templateName+"/template.wscso");
    if(hr.getCode() - 404 == 0){
        return error("模版不存在");
    }

    BaseVO vo = templateService.importTemplate(hr.getContent(), true);
    if(vo.getResult() - BaseVO.SUCCESS == 0){
        //导入完毕后,还要刷新当前的模版页面、模版变量缓存。这里清空缓存,下次使用时从新从数据库加载最新的
        request.getSession().setAttribute("templatePageListVO", null);
        Func.getUserBeanForShiroSession().setTemplateVarCompileDataMap(null);
        Func.getUserBeanForShiroSession().setTemplateVarMapForOriginal(null);

        AliyunLog.addActionLog(getSiteId(), "云端导入模版文件成功!");
    }
    return vo;
}
项目:participationSystem3b    文件:AdminController.java   
@RequestMapping(value = "/modificarCat", method = RequestMethod.POST)
 public String IrAModificarCat(HttpSession session,Model model,@RequestParam("categoria") Long cat) throws BusinessException {
Categoria categor=Services.getSystemServices().findCategoriaById(cat);
model.addAttribute("cat", categor);
String palabras="";
for(String pal:categor.getPalabrasNoPermitidas()){
    palabras+=pal+";";
}
model.addAttribute("palabrasNoPermitidas", palabras);
DateFormat format = new SimpleDateFormat("dd/MM/yyy");
String fin = format.format(categor.getFechaFin());
String inicio = format.format(categor.getFechaInicio());
model.addAttribute("fechaInicio", inicio);
model.addAttribute("fechaFin", fin);

        return "editarCategoria";
 }
项目:MI-S    文件:MenuController.java   
/**
 * 加载分页列表数据
 *
 * @param model
 * @return
 */
@RequestMapping("/article/list")
public String selectArticleList(Page pages, Model model) {
    Page<ArticleVo> page;
    page = iArticleService.selectArticleList(new Page(pages.getCurrent(), 5));
    model.addAttribute("page", page);

    return "blog/main";
}
项目:Spring-5.0-Cookbook    文件:LoginController.java   
@RequestMapping(value = "/react/login.html", method = RequestMethod.GET)
public String login(@RequestParam(name = "error", required = false) String error, Model model) {
    try {
        if (error.equalsIgnoreCase("true")) {
            String errorMsg = "Login Error";
            model.addAttribute("errorMsg", errorMsg);
        } else {
            model.addAttribute("errorMsg", error);
        }
    } catch (NullPointerException e) {
        logger.info("LoginController#form task started.");
        return "login-form";
    }
    logger.info("LoginController#form task started.");
    return "login-form";
}
项目:simple-hostel-management    文件:TokenManagerTestController.java   
@RequestMapping(value = TokenManagerTest.TEST_MAPPING, method = RequestMethod.GET)
public void testController(HttpSession session, Model model) {

    TokenManager tokenman = new TokenManager("suffix");
    tokenman.addToken(session);
    tokenman.addToken(model);

    assertTrue(tokenman.getTokenFrom(session) != -1);
    assertTrue(tokenman.getTokenFrom(model) != -1);
    assertTrue(tokenman.isTokenValid(session, model));

    tokenman.deleteTokenFrom(session);
    assertFalse(tokenman.isTokenValid(session, model));

    tokenman.addToken(session);
    tokenman.deleteTokenFrom(model);
    assertFalse(tokenman.isTokenValid(session, model));

    tokenman.addToken(model);
}
项目:Towan    文件:RegisterController.java   
@Transactional
@RequestMapping(value = "/changePassword", method = RequestMethod.POST)
public String doChangePassword(@Valid @ModelAttribute UserModel newUserModel, BindingResult bindingResult, Model model) {

    // Get user from DB
    UserModel user = null;
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    List<UserModel> userList = userRepository.findByUsername(auth.getName());
    user = userList.get(0);

    // Update DB
    UserModel newUser = new UserModel(user.getUsername(), passwordEncoder.encode(newUserModel.getPassword()), user.getEmail_address());
    newUser.setActivated(true);
    userRepository.delete(user);
    userRepository.save(newUser);

    return "index";
}
项目:lemon    文件:DiskController.java   
/**
 * 列表.
 */
@RequestMapping("disk-list")
public String list(@RequestParam("u") String u,
        @RequestParam(value = "path", required = false) String path,
        Model model) {
    if (path == null) {
        path = "";
    }

    String userId = u;

    List<DiskShare> diskShares = diskShareManager.findBy("creator", userId);
    model.addAttribute("diskShares", diskShares);
    model.addAttribute("path", path);

    return "disk/disk-list";
}
项目:media_information_service    文件:MainController.java   
@PostMapping("/result_film")
public String mediaFilmSubmit(@ModelAttribute Media media, Model model, HttpServletRequest request ) {
    LinkedList<FilmInfo> a = null;
    String maxResult= media.getMaxResult();
    if(media.getTitle().equals("")) return "media_film";
    if (maxResult.equals("")) maxResult="10";
    String languagecode=media.getLanguage();
    if (languagecode.length()!=2) languagecode="";
    try {
        a = APIOperations.filmGetInfo(media.getTitle(), maxResult,languagecode,media.getYear(),media.getOrderBy());
    } catch (UnirestException e) {
        e.printStackTrace();
        return String.valueOf(HttpStatus.INTERNAL_SERVER_ERROR);
    }
    RabbitSend.sendMediaRequest(media.getTitle(),"Film",request);
    if (a.size()==0) return "no_result";
    model.addAttribute("mediaList", a);
    return "result_film";
}
项目:Spring-Security-Third-Edition    文件:ErrorController.java   
@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;
}
项目:sjk    文件:TopAppController.java   
@RequestMapping(value = "/{id}.merge.d")
@ResponseBody
public String merge(@PathVariable int id, Model model) {
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    TopApp topapp = topAppService.get(id);
    try {
        if (topapp != null) {
            model.addAttribute("topapp", topapp);
        }
        server.put("code", SvrResult.OK.getCode());
        server.put("msg", SvrResult.OK.getMsg());
    } catch (Exception e) {
        model.addAttribute("rstCode", 1);
        logger.error("Exception", e);
    }
    output.put("result", server);
    return output.toJSONString(jsonStyle);
}
项目:Learning-Spring-Boot-2.0-Second-Edition    文件:HomeController.java   
@GetMapping("/")
public Mono<String> index(Model model) {
    model.addAttribute("images",
        imageService
            .findAllImages()
            .map(image -> new HashMap<String, Object>() {{
                put("id", image.getId());
                put("name", image.getName());
                put("comments",
                    // tag::comments[]
                    restTemplate.exchange(
                        "http://COMMENTS/comments/{imageId}",
                        HttpMethod.GET,
                        null,
                        new ParameterizedTypeReference<List<Comment>>() {},
                        image.getId()).getBody());
                // end::comments[]
            }})
    );
    return Mono.just("index");
}
项目:wangmarket    文件:RoleAdminController_.java   
/**
 * 编辑资源
 * @param id 资源的id,Permission.id 
 */
@RequiresPermissions("adminRolePermission")
@RequestMapping("editPermission")
public String editPermission(@RequestParam(value = "id", required = true) int id,Model model, HttpServletRequest request){
    if(id>0){
        Permission permission = sqlService.findById(Permission.class, id);
        if(permission!=null){
            String parentPermissionDescription="顶级";
            if(permission.getParentId()>0){
                Permission parentPermission = sqlService.findById(Permission.class, permission.getParentId());
                parentPermissionDescription = parentPermission.getName() +","+ parentPermission.getDescription();
            }

            ActionLogCache.insert(request, permission.getId(), "进入修改资源Permission页面", "所属上级:"+parentPermissionDescription);

            model.addAttribute("permission", permission);
            model.addAttribute("parentPermissionDescription", parentPermissionDescription);
            return "iw/admin/role/permission";
        }
    }
    return error(model, "出错,参数错误");
}
项目:La-Apostada    文件:UsuarioController.java   
@RequestMapping("/cuenta")
public String cuenta(Model model) {
    Usuario usuario = sessionService.getUsuarioActual();
    if (usuario == null) {
        return "redirect:/";
    }

    List<Apuesta> apuestasGanadas= apuestaService.findApuestaUserGanada(usuario);
    List<Apuesta> apuestasPerdidas = apuestaService.findApuestaUserPerdida(usuario);
    List<Apuesta> apuestasNoFinalizadas = apuestaService.findApuestaUserNoFinalizada(usuario);

    model.addAttribute("usuario", usuario);
    model.addAttribute("apuestasGanadas", apuestasGanadas);
    model.addAttribute("apuestasPerdidas", apuestasPerdidas);
    model.addAttribute("apuestasNoFinalizadas", apuestasNoFinalizadas);

    return "cuenta";
}
项目:forweaver2.0    文件:RepositoryController.java   
@RequestMapping("/{creatorName}/{repositoryName}/delete")
public String delete(Model model,
        @PathVariable("creatorName") String creatorName,
        @PathVariable("repositoryName") String repositoryName) {
    Repository repository = repositoryService.get(creatorName+"/"+repositoryName);
    Weaver currentWeaver = weaverService.getCurrentWeaver();
    List<String> tags = new ArrayList<String>();
    tags.add("@"+repository.getName());

    if(repositoryService.delete(currentWeaver, repository))
        for(Post post:postService.getPosts(tags, null, null, "", 1, Integer.MAX_VALUE)) // 저장소에 쓴 글 모두 삭제
            postService.delete(post);

    else{
        model.addAttribute("say", "삭제하지 못하였습니다!!!");
        model.addAttribute("url", "/repository/"+creatorName+"/"+repositoryName);
        return "/alert";
    }

    return "redirect:/repository/";
}
项目:BackOffice    文件:MainController.java   
@RequestMapping(value = "/html/logs", method = RequestMethod.GET)
public String getLogs(Model model
        ,@RequestParam(value="date", defaultValue="none") String date
        ,@RequestParam(value="entry", defaultValue="westUest") String entry) throws IOException, ParseException {
    LOG.info("\nИнициирован запрос \"/html/logs\" с параметрами:\nDate: "+date+"\nentry: "+entry);
    if(date.equals("none"))logModel = new LogModel(THIS_DAY);
    else logModel = new LogModel(date);
    HashMap<String,ArrayList<String >> result = new HashMap<>();
    ArrayList<String> listOfAllDailyLogs = logModel.getListOfAllDailyLogs();
    for (String log : listOfAllDailyLogs){
        ArrayList<String> logData = logModel.searchInLogByEntry(log,entry);
        if (!logData.isEmpty()){
            System.out.println("В логе: "+ log + " найдено совпадение: "+ entry);
            result.put(log,logData);
        }
    }
    model.addAttribute("HMapLogsResult",result);
    return "logs";
}
项目:crud-admin-spring-boot-starter    文件:CrudAdminController.java   
/**
 * Add all common attributes used in all templates
 * 
 * @param model
 *            current model
 * @param repoAdmin
 *            current repository model
 * @param page
 *            current page
 * @param size
 *            current page size
 */
private void addAttributes(Model model, CrudAdminRepository repoAdmin, int page, int size) {
    model.addAttribute("adminpath", crudAdminProperties.getUrl());
    model.addAttribute("domainname", repoAdmin.getDomainTypeName());
    model.addAttribute("domainnamelowercase", repoAdmin.getDomainTypeNameLowerCase());
    model.addAttribute("formatteddomainname", CrudAdminUtils.formatField(repoAdmin.getDomainTypeName()));
    model.addAttribute("cdnlibraries",crudAdminProperties.getCdnLibraries());
    model.addAttribute("page", page);
    model.addAttribute("size", size);
    List<String> allDomainNames = repositoryMap.values().stream().map(repo -> repo.getDomainTypeName())
            .collect(Collectors.toList());
    model.addAttribute("alldomainnames", allDomainNames);
}
项目:xxl-api    文件:XxlApiDocumentController.java   
/**
 * 更新,API
 * @return
 */
@RequestMapping("/updatePage")
public String updatePage(Model model, int id) {

    // document
    XxlApiDocument xxlApiDocument = xxlApiDocumentDao.load(id);
    if (xxlApiDocument == null) {
        throw new RuntimeException("操作失败,接口ID非法");
    }
    model.addAttribute("document", xxlApiDocument);
    model.addAttribute("requestHeadersList", (StringUtils.isNotBlank(xxlApiDocument.getRequestHeaders()))?JacksonUtil.readValue(xxlApiDocument.getRequestHeaders(), List.class):null );
    model.addAttribute("queryParamList", (StringUtils.isNotBlank(xxlApiDocument.getQueryParams()))?JacksonUtil.readValue(xxlApiDocument.getQueryParams(), List.class):null );
    model.addAttribute("responseParamList", (StringUtils.isNotBlank(xxlApiDocument.getResponseParams()))?JacksonUtil.readValue(xxlApiDocument.getResponseParams(), List.class):null );

    // project
    int projectId = xxlApiDocument.getProjectId();
    model.addAttribute("productId", projectId);

    // groupList
    List<XxlApiGroup> groupList = xxlApiGroupDao.loadAll(projectId);
    model.addAttribute("groupList", groupList);

    // enum
    model.addAttribute("RequestMethodEnum", RequestConfig.RequestMethodEnum.values());
    model.addAttribute("requestHeadersEnum", RequestConfig.requestHeadersEnum);
    model.addAttribute("QueryParamTypeEnum", RequestConfig.QueryParamTypeEnum.values());
    model.addAttribute("ResponseContentType", RequestConfig.ResponseContentType.values());

    // 响应数据类型
    XxlApiDataType responseDatatypeRet = xxlApiDataTypeService.loadDataType(xxlApiDocument.getResponseDatatypeId());
    model.addAttribute("responseDatatype", responseDatatypeRet);

    return "document/document.update";
}
项目:Cloud-Foundry-For-Developers    文件:HomeController.java   
@RequestMapping("/")
public String home(Model model) {
    model.addAttribute("instanceInfo", instanceInfo);

    if (instanceInfo != null) {
        Map<Class<?>, String> services = new LinkedHashMap<Class<?>, String>();
        services.put(dataSource.getClass(), toString(dataSource));
        services.put(mongoDbFactory.getClass(), toString(mongoDbFactory));
        services.put(redisConnectionFactory.getClass(), toString(redisConnectionFactory));
        services.put(rabbitConnectionFactory.getClass(), toString(rabbitConnectionFactory));
        model.addAttribute("services", services.entrySet());
    }

    return "home";
}
项目:spring-boot-continuous-delivery    文件:AccountController.java   
@RequestMapping(path="/account", method=RequestMethod.POST)
public String createAccount(Model model, @RequestParam(value="name", required=false, defaultValue="everyone") String name) {
    Response response = account.save(new Account(name));
    model.addAttribute("name", name);
    model.addAttribute("id", response.getId());
    return "account";
}
项目:CityPower-Build-Sample    文件:DashboardController.java   
@RequestMapping("/dashboard")
public String dashboard(@RequestParam(defaultValue = "0") int page,Model model) {

    PagedResources<IncidentBean> incidents = service.getIncidentsPaged(page,9);
    model.addAttribute("allIncidents", incidents.getContent());
    model.addAttribute("pageInfo", incidents.getMetadata());        
    return "Dashboard/index";
}
项目:Monsters_Portal    文件:LoginAdminController.java   
@RequestMapping("Admin/efetuaLoginAdmin")
public String efetuaLoginAdmin(Model model,Funcionario funcionario, HttpSession session) {

  Funcionario autentica = (Funcionario) dao.autenticaEmailSenha(funcionario.getEmail_fun(), funcionario.getSenha_fun());
  if(autentica != null) {
    session.setAttribute("administradorLogado", autentica);
    session.setAttribute("permissao", autentica.getCargo().getPermissao());
    return "redirect:dashboard";
  }

  model.addAttribute("login_error", "Usuário ou senha incorretos");
  return "redirect:LoginAdmin";
}
项目:JSiter    文件:MainController.java   
@GetMapping("/app/home")
public String home(HttpServletRequest request, HttpServletResponse response, Model model) {
    uiModelUtil.initialize(model);
    UserSession session = sessionUtil.getSessionFromCookie(request, response);
    String userId = session.getUserId();
    User user = userDao.selectById(userId);
    model.addAttribute("user", user);
    return "app/home";
}
项目:lemon    文件:FeedbackController.java   
@RequestMapping("submit")
public String submit(@RequestParam("content") String content,
        @RequestParam("contact") String contact, Model model) {
    String userId = currentUserHolder.getUserId();
    FeedbackInfo feedbackInfo = new FeedbackInfo();
    feedbackInfo.setContent(content);
    feedbackInfo.setContact(contact);
    feedbackInfo.setCreateTime(new Date());
    feedbackInfo.setUserId(userId);
    feedbackInfoManager.save(feedbackInfo);

    return "feedback/submit";
}
项目:Spring-web-shop-project    文件:userAccountBookmarkers.java   
@RequestMapping(value = "changePasswd", method = RequestMethod.GET)
public String changePasswordBookmarker(Model model) {
    User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();

    model.addAttribute("user", user);
    return "userAccount/options/changePassword";
}
项目:scoold    文件:TagsController.java   
@GetMapping
public String get(@RequestParam(required = false, defaultValue = "count") String sortby,
        HttpServletRequest req, Model model) {
    Pager itemcount = utils.getPager("page", req);
    itemcount.setSortby(sortby);
    itemcount.setDesc(!"tag".equals(sortby));
    List<Tag> tagslist = utils.getParaClient().findTags("*", itemcount);
    model.addAttribute("path", "tags.vm");
    model.addAttribute("title", utils.getLang(req).get("tags.title"));
    model.addAttribute("tagsSelected", "navbtn-hover");
    model.addAttribute("itemcount", itemcount);
    model.addAttribute("tagslist", tagslist);
    return "base";
}
项目:scrumtracker2017    文件:ErrorController.java   
@RequestMapping({"/*", "*", "/api/*"})
public String goError(Model model,
                      HttpServletRequest request,
                      HttpServletResponse response)
{
    model.addAttribute("isErrorPage", true);

    model.addAttribute("projects", projectService.findAll());

    model.addAttribute("sprints", sprintService.findAll());

    return "erreur";
}
项目:Learning-Spring-Boot-2.0-Second-Edition    文件:HomeController.java   
@GetMapping("/")
public Mono<String> index(Model model) {
    model.addAttribute("images",
        imageService.findAllImages());
    model.addAttribute("extra",
        "DevTools can also detect code changes too");
    return Mono.just("index");
}
项目:lemon    文件:SendmailTemplateController.java   
@RequestMapping("sendmail-template-input")
public String input(@RequestParam(value = "id", required = false) Long id,
        Model model) {
    if (id != null) {
        SendmailTemplate sendmailTemplate = sendmailTemplateManager.get(id);
        model.addAttribute("model", sendmailTemplate);
    }

    return "sendmail/sendmail-template-input";
}
项目:lemon    文件:BookInfoController.java   
@RequestMapping("book-info-list")
public String list(@ModelAttribute Page page,
        @RequestParam Map<String, Object> parameterMap, Model model) {
    List<PropertyFilter> propertyFilters = PropertyFilter
            .buildFromMap(parameterMap);
    page = bookInfoManager.pagedQuery(page, propertyFilters);

    model.addAttribute("page", page);

    return "book/book-info-list";
}
项目:nixmash-blog    文件:GeneralController.java   
@RequestMapping(value = "/dev/banner", method = GET)
public String homeBannerDisplay(Model model, @RequestParam(value = "id") long siteImageId) {
    String springVersion = webUI.parameterizedMessage("home.spring.version", SpringBootVersion.getVersion());
    model.addAttribute("springVersion", springVersion);
        SiteImage siteImage = siteService.getHomeBanner(siteImageId);
        model.addAttribute("siteImage", siteImage);

    Slice<Post> posts = postService.getPublishedPosts(0, 10);
    if (posts.getContent().size() > 0)
        model.addAttribute("posts", posts);

    return HOME_VIEW;
}
项目:participationSystem3b    文件:UserController.java   
private void votarComentario(HttpSession session, Model model, Long id, boolean flag) throws BusinessException {
    Citizen c = (Citizen) session.getAttribute("user");
    Comentario comentario = Services.getCitizenServices().findComentarioById(id);
    VotoComentario voto = new VotoComentario(comentario,c,flag);

    try {
        Services.getCitizenServices().voteComentario(voto);
        kafkaProducer.send(Topics.VOTE_COMMENT, Message.setMessage(voto));
    } catch (Exception e) {

    }

    SugerenciaVista sVista = new SugerenciaVista(comentario.getSugerencia());
    model.addAttribute("s", sVista);
}
项目:lemon    文件:DelegateController.java   
/**
 * 自动委托页面
 * 
 * @return
 */
@RequestMapping("delegate-prepareAutoDelegate")
public String prepareAutoDelegate(Model model) {
    String tenantId = tenantHolder.getTenantId();
    Page page = processConnector.findProcessDefinitions(tenantId, new Page(
            1, 100));
    model.addAttribute("page", page);

    return "delegate/delegate-prepareAutoDelegate";
}
项目:theLXGweb    文件:adminPlayer.java   
@PostMapping("/get/change.team")
    public String updatePlayer(@ModelAttribute("playerObject") player player, Model model){

        player updatedPlayer = players.getPlayerById(player.getId());
        String oldTeam = updatedPlayer.getTeamSelected();

        updatedPlayer.setTeamSelected(player.getTeamSelected());
        updatedPlayer.setTeamCountry(player.getTeamCountry());

        players.updatePlayer(updatedPlayer);
//        System.out.println(player.toString());
        model.addAttribute("playerUpdated", updatedPlayer);
        model.addAttribute("oldPlayerTeam", oldTeam);
        return "redirect:/admin/players/all";
    }
项目:lemon    文件:PlmController.java   
/**
 * 准备,创建任务.
 */
@RequestMapping("create")
public String create(@RequestParam("projectId") Long projectId, Model model)
        throws Exception {
    PlmProject plmProject = plmProjectManager.get(projectId);
    model.addAttribute("plmProject", plmProject);

    List<PlmVersion> plmVersions = plmVersionManager.findBy("plmProject",
            plmProject);
    model.addAttribute("plmVersions", plmVersions);

    return "plm/create";
}
项目:tdd-pingpong    文件:ChallengeController.java   
@RequestMapping("/startChallenge/{challengeId}")
public String startChallenge(Model model, @PathVariable long challengeId) {
  logger.debug("Starting challenge");
  Challenge challenge = challengeService.findOne(challengeId);
  model.addAttribute("challenge", challenge);
  return "startchallenge";
}
项目:nixmash-blog    文件:AdminPostsController.java   
@RequestMapping(value = "/update", method = POST)
public String updatePost(@Valid PostDTO postDTO, BindingResult result, Model model,
                         RedirectAttributes attributes, HttpServletRequest request) throws PostNotFoundException {
    if (result.hasErrors()) {
        model.addAttribute("postDTO", postDTO);
        model.addAllAttributes(getPostLinkAttributes(request, postDTO.getPostType()));
        return ADMIN_POSTLINK_UPDATE_VIEW;
    } else {
        postDTO.setPostContent(cleanContentTailHtml(postDTO.getPostContent()));

        Post post = postService.update(postDTO);

        PostDoc postDoc = postDocService.getPostDocByPostId(post.getPostId());
        boolean postIsIndexed = postDoc != null;
        if (post.getIsPublished()) {

            post.setPostMeta(jsoupService.updatePostMeta(postDTO));
            if (applicationSettings.getSolrEnabled()) {
                if (postIsIndexed)
                    postDocService.updatePostDocument(post);
                else
                    postDocService.addToIndex(post);
            }

            fmService.createPostAtoZs();
        } else {
            // remove postDocument from Solr Index if previously marked "Published", now marked "Draft"
            if (postIsIndexed)
                if (applicationSettings.getSolrEnabled()) {
                    postDocService.removeFromIndex(postDoc);
                }
        }

        webUI.addFeedbackMessage(attributes, FEEDBACK_POST_UPDATED);
        return "redirect:/admin/posts";
    }
}
项目:wangmarket    文件:SiteController.java   
/**
 * 刷新,重新生成sitemap.xml文件
 * @return
 */
@RequestMapping("refreshSitemap.do")
public String refreshSitemap(@RequestParam(value = "siteid", required = true) int siteid,
        Model model){

    Site site = sqlService.findAloneBySqlQuery("SELECT * FROM site WHERE id = "+siteid, Site.class);
    siteService.refreshSiteMap(site);

    AliyunLog.addActionLog(site.getId(), "刷新,重新生成sitemap.xml文件");

    return success(model, "成功");
}
项目:SpringMicroservice    文件:BrownFieldSiteController.java   
@RequestMapping(value="/search-booking-get", method=RequestMethod.POST)
public String searchBookingSubmit(@ModelAttribute UIData uiData, Model model) {
    Long id = new Long(uiData.getBookingid());
        BookingRecord booking = bookingClient.getForObject("http://book-apigateway/api/booking/get/"+id, BookingRecord.class);
    Flight flight = new Flight(booking.getFlightNumber(), booking.getOrigin(),booking.getDestination()
            ,booking.getFlightDate(),new Fares(booking.getFare(),"AED"));
    Passenger pax = booking.getPassengers().iterator().next();
    Passenger paxUI = new Passenger(pax.getFirstName(),pax.getLastName(),pax.getGender(),null);
    uiData.setPassenger(paxUI);
    uiData.setSelectedFlight(flight);
    uiData.setBookingid(id.toString()); 
    model.addAttribute("uidata", uiData);
   return "bookingsearch";
}