@@ -0,0 +1,2020 @@
+/**%0A * ychen%0A * Copyright (c).%0A */%0Apackage cn.edu.fudan.iipl.web;%0A%0Aimport java.util.List;%0A%0Aimport javax.annotation.Resource;%0A%0Aimport org.springframework.stereotype.Controller;%0Aimport org.springframework.ui.ModelMap;%0Aimport org.springframework.web.bind.annotation.PathVariable;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport org.springframework.web.bind.annotation.RequestMethod;%0A%0Aimport cn.edu.fudan.iipl.dao.ArticleDao;%0Aimport cn.edu.fudan.iipl.entity.Article;%0Aimport cn.edu.fudan.iipl.enums.BlogExceptionEnum;%0Aimport cn.edu.fudan.iipl.exception.BlogException;%0A%0A/**%0A * %E6%96%87%E7%AB%A0controller%0A * @author racing%0A * @version $Id: ArticleList.java, v 0.1 Aug 8, 2015 3:49:42 PM racing Exp $%0A */%0A@Controller%0A@RequestMapping(%22/article%22)%0Apublic class ArticleController %7B%0A%0A    /** articleDao%E5%AF%B9%E8%B1%A1 */%0A    @Resource(type = ArticleDao.class)%0A    private ArticleDao          articleDao;%0A%0A    /** %E6%96%87%E7%AB%A0%E5%88%97%E8%A1%A8%E9%A1%B5%E9%9D%A2 */%0A    private static final String ARTICLE_LIST_JSP    = %22/WEB-INF/jsp/article/article_list.jsp%22;%0A%0A    /** %E6%96%87%E7%AB%A0%E8%AF%A6%E6%83%85%E9%A1%B5%E9%9D%A2 */%0A    private static final String ARTICLE_PROFILE_JSP = %22/WEB-INF/jsp/article/article_profile.jsp%22;%0A%0A    /**%0A     * %E6%98%BE%E7%A4%BA%E6%96%87%E7%AB%A0%E5%88%97%E8%A1%A8%E9%A1%B5%E9%9D%A2%0A     * @param request%0A     * @return%0A     */%0A    @RequestMapping(value = %22/list%22, method = %7B RequestMethod.GET %7D)%0A    public String showList(ModelMap model) %7B%0A        List%3CArticle%3E articleList = articleDao.getAll();%0A        model.addAttribute(%22articles%22, articleList);%0A        return ARTICLE_LIST_JSP;%0A    %7D%0A%0A    /**%0A     * %E6%98%BE%E7%A4%BA%E6%96%87%E7%AB%A0%E5%86%85%E5%AE%B9%E9%A1%B5%E9%9D%A2%0A     * @param model%0A     * @return%0A     */%0A    @RequestMapping(value = %22/profile/%7Bid%7D%22, method = %7B RequestMethod.GET %7D)%0A    public String showProfile(ModelMap model, @PathVariable String id) %7B%0A        int articleId;%0A        try %7B%0A            articleId = Integer.parseInt(id);%0A        %7D catch (Exception e) %7B%0A            throw new BlogException(BlogExceptionEnum.ARTICLE_ID_NOT_FOUND);%0A        %7D%0A%0A        Article article = articleDao.getById(articleId);%0A        model.addAttribute(%22article%22, article);%0A        return ARTICLE_PROFILE_JSP;%0A    %7D%0A%7D%0A

create articleController