資源簡介

代碼片段和文件信息
package?cn.home.controller;
import?java.util.List;
import?javax.annotation.Resource;
import?javax.servlet.http.HttpServletRequest;
import?org.springframework.stereotype.Controller;
import?org.springframework.ui.Model;
import?org.springframework.web.bind.annotation.RequestMapping;
import?org.springframework.web.bind.annotation.RequestParam;
import?cn.home.pojo.category;
import?cn.home.pojo.entry;
import?cn.home.service.bookService;
import?cn.home.service.categoryService;
import?cn.home.tools.Page;
@Controller
public?class?bookController?{
@Resource
private?bookService?service;
@Resource
private?categoryService?cService;
@RequestMapping(value?=“/index“)
public?String?pageList(Model?model?category?cat
@RequestParam(value?=?“pageIndex“?required?=?false)?Integer?pageIndex
)?{
Page?page?=?new?Page();
int?pageSize?=?4;
Integer?currPageNo?=?1;
if?(pageIndex?!=?null)?{
try?{
currPageNo?=?Integer.valueOf(pageIndex);
}?catch?(NumberFormatException?e)?{
e.printStackTrace();
}
}
int?totalCount?=?service.count();
if?(cat.getId()!=null)?{
totalCount?=?service.entryCountById(cat.getId());
}
page.setCurrPageNo(currPageNo);
page.setPageSize(pageSize);
page.setTotalCount(totalCount);
int?totalPageCount?=?page.getTotalPageCount();
if?(totalCount==0)?{
totalPageCount?=?1;
}
//?控制首頁和尾頁
if?(currPageNo?1)?{
currPageNo?=?1;
}?else?if?(currPageNo?>?totalPageCount)?{
currPageNo?=?totalPageCount;
}
List?list?=?service.getPageList(cat.getId()currPageNo?pageSize);
Listlist1=cService.list1();
model.addAttribute(“list“?list);
model.addAttribute(“page“?page);
model.addAttribute(“list1“?list1);
model.addAttribute(“categoryId“?cat.getId());
return?“index“;
}
@RequestMapping(“add“)
public?String?add(Model?modelcategory?cat){
model.addAttribute(“id“?cat.getId());
return?“add“;
}
@RequestMapping(“addsave“)
public?String?addsave(entry?ent){
service.addsave(ent);
return?“redirect:index“;
}
@RequestMapping(“delete“)
public?String?deletedog(Integer?id){
service.delete(id);
return?“redirect:index“;
}
@RequestMapping(“/selectById“)
public?String?selectById(Model?model?Integer?id)?{?
entry?list=service.selectById(id);
model.addAttribute(“list“?list);
model.addAttribute(“id“?id);
return?“modify“;
}
@RequestMapping(“/modifysave“)
public?String?modify(entry?ent){
??service.modifysave(ent);
??return?“redirect:index“;???
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-01-02?13:44??基于SSM簡單的增刪改查案例源代碼+sql\
?????目錄???????????0??2018-01-01?22:38??基于SSM簡單的增刪改查案例源代碼+sql\Home\
?????文件????????3096??2018-01-01?23:18??基于SSM簡單的增刪改查案例源代碼+sql\Home\.classpath
?????文件????????1329??2017-12-28?23:00??基于SSM簡單的增刪改查案例源代碼+sql\Home\.project
?????目錄???????????0??2018-01-01?23:21??基于SSM簡單的增刪改查案例源代碼+sql\Home\.settings\
?????文件?????????522??2017-12-28?23:00??基于SSM簡單的增刪改查案例源代碼+sql\Home\.settings\.jsdtscope
?????文件??????????76??2018-01-01?23:12??基于SSM簡單的增刪改查案例源代碼+sql\Home\.settings\com.genuitec.eclipse.migration.prefs
?????文件?????????364??2018-01-01?23:18??基于SSM簡單的增刪改查案例源代碼+sql\Home\.settings\org.eclipse.jdt.core.prefs
?????文件?????????551??2017-12-28?23:00??基于SSM簡單的增刪改查案例源代碼+sql\Home\.settings\org.eclipse.wst.common.component
?????文件?????????414??2018-01-01?23:12??基于SSM簡單的增刪改查案例源代碼+sql\Home\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件??????????49??2017-12-28?23:00??基于SSM簡單的增刪改查案例源代碼+sql\Home\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件???????????6??2017-12-28?23:00??基于SSM簡單的增刪改查案例源代碼+sql\Home\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????目錄???????????0??2018-01-01?22:38??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\
?????目錄???????????0??2018-01-01?22:38??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\me
?????文件??????????39??2017-12-28?23:00??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\me
?????目錄???????????0??2018-01-01?22:38??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\WEB-INF\
?????目錄???????????0??2018-01-02?10:27??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\WEB-INF\classes\
?????文件????????3611??2017-12-28?23:00??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\WEB-INF\classes\applicationContext-mybatis.xm
?????目錄???????????0??2018-01-02?10:27??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\WEB-INF\classes\cn\
?????目錄???????????0??2018-01-02?10:27??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\WEB-INF\classes\cn\home\
?????目錄???????????0??2018-01-02?10:27??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\WEB-INF\classes\cn\home\controller\
?????文件????????3784??2018-01-02?10:27??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\WEB-INF\classes\cn\home\controller\bookController.class
?????目錄???????????0??2018-01-02?10:27??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\WEB-INF\classes\cn\home\dao\
?????文件?????????724??2018-01-02?10:27??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\WEB-INF\classes\cn\home\dao\bookMapper.class
?????文件????????1444??2017-12-28?23:00??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\WEB-INF\classes\cn\home\dao\bookMapper.xm
?????文件?????????224??2018-01-02?10:27??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\WEB-INF\classes\cn\home\dao\categoryMapper.class
?????文件?????????313??2017-12-28?23:00??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\WEB-INF\classes\cn\home\dao\categoryMapper.xm
?????目錄???????????0??2018-01-02?10:27??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\WEB-INF\classes\cn\home\pojo\
?????文件?????????772??2018-01-02?10:27??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\WEB-INF\classes\cn\home\pojo\category.class
?????文件????????1616??2018-01-02?10:27??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\WEB-INF\classes\cn\home\pojo\entry.class
?????目錄???????????0??2018-01-02?10:27??基于SSM簡單的增刪改查案例源代碼+sql\Home\WebRoot\WEB-INF\classes\cn\home\service\
............此處省略72個文件信息
評論
共有 條評論