java新闻项目Springmvc框架结合使用.docx
- 文档编号:2397971
- 上传时间:2022-10-29
- 格式:DOCX
- 页数:15
- 大小:247.28KB
java新闻项目Springmvc框架结合使用.docx
《java新闻项目Springmvc框架结合使用.docx》由会员分享,可在线阅读,更多相关《java新闻项目Springmvc框架结合使用.docx(15页珍藏版)》请在冰豆网上搜索。
java新闻项目Springmvc框架结合使用
java_新闻项目_Springmvc框架结合使用
Admin
@Controller
@RequestMapping("/admin")
publicclassAdminController{
@RequestMapping("/footPrint")
privateStringfootPrint(Map
SqlSessionssession=MyBatisTemple.getSession().openSession();
NewsViewDaonewview=ssession.getMapper(NewsViewDao.class);
List
map.put("newss",newss);
return"admin/footPrint";
}
@RequestMapping("/adminDoBidden")
privateStringadminDoBidden(intid,intstatus){
SqlSessionssession=MyBatisTemple.getSession().openSession();
AdminDaoadmins=ssession.getMapper(AdminDao.class);
admins.forbidden(status,id);
mit();
return"admin/index";
}
@RequestMapping("/adminDoEdit")
privateStringadminDoEdit(AdminEntityadminentity){
AdminEntityadmin=newAdminEntity(adminentity.getUsername(),
adminentity.getUpass(),adminentity.getName(),
adminentity.getStatus());
admin.setId(adminentity.getId());
SqlSessionssession=MyBatisTemple.getSession().openSession();
AdminDaoadmins=ssession.getMapper(AdminDao.class);
admins.updateAdmin(admin);
mit();
return"redirect:
AdminList";
}
@RequestMapping("/adminToEdit")
privateStringadminToEdit(intid,Map
SqlSessionssession=MyBatisTemple.getSession().openSession();
AdminDaoadmins=ssession.getMapper(AdminDao.class);
AdminEntityadmin=admins.findIOne(id);
map.put("admin",admin);
return"admin/editAdmin";
}
@RequestMapping("/adminDoAdd")
privateStringadminDoAdd(AdminEntityadminentity){
AdminEntityadmin=newAdminEntity(adminentity.getUsername(),
adminentity.getUpass(),adminentity.getName(),
adminentity.getStatus());
SqlSessionssession=MyBatisTemple.getSession().openSession();
AdminDaoadmins=ssession.getMapper(AdminDao.class);
admins.addAdmin(admin);
mit();
return"redirect:
AdminList";
}
@RequestMapping("/adminToAdd")
privateStringadminToAdd(){
return"admin/addAdmin";
}
@RequestMapping("/AdminList")
privateStringAdminList(Map
SqlSessionssession=MyBatisTemple.getSession().openSession();
AdminDaoadmin=ssession.getMapper(AdminDao.class);
List
map.put("admins",admins);
return"admin/listAdmin";
}
@RequestMapping("/NewsDoEdit")
privateStringNewsDoEdit(intid,Stringtitle,Stringauthor,
intpageview,Stringcontent1,intstatus){
NewsEntitynews=newNewsEntity(title,author,newDate(),pageview,
content1,status);
news.setId(id);
SqlSessionssession=MyBatisTemple.getSession().openSession();
NewsDaonewss=ssession.getMapper(NewsDao.class);
newss.updateNews(news);
mit();
return"redirect:
NewsList";
}
@RequestMapping("/NewsToEdit")
privateStringNewsToEdit(intid,Map
SqlSessionssession=MyBatisTemple.getSession().openSession();
NewsDaonewss=ssession.getMapper(NewsDao.class);
NewsEntitynews=newss.findIOne(id);
map.put("news",news);
return"admin/editNews";
}
@RequestMapping("/NewsDoAdd")
privateStringNewsDoAdd(Stringtitle,Stringauthor,Stringcontent1){
NewsEntitynewdao=newNewsEntity(title,author,newDate(),0,
content1,0);
SqlSessionssession=MyBatisTemple.getSession().openSession();
NewsDaonewss=ssession.getMapper(NewsDao.class);
newss.addNews(newdao);
mit();
return"redirect:
NewsList";
}
@RequestMapping("/NewsToadd")
privateStringNewsToadd(){
return"admin/addNews";
}
@RequestMapping("/NewsList")
privateStringNewsList(Map
SqlSessionssession=MyBatisTemple.getSession().openSession();
NewsDaonews=ssession.getMapper(NewsDao.class);
List
map.put("newss",newss);
return"admin/listNews";
}
@RequestMapping("/index")
privateStringindex(Stringusername,Stringupass){
System.out.println(username+upass);
SqlSessionssession=MyBatisTemple.getSession().openSession();
AdminDaoadmins=ssession.getMapper(AdminDao.class);
AdminEntityadmin=admins.login(username,upass,0);
if(admin!
=null){
//System.out.println("login����");
//HttpSessionsession=request.getSession();
//session.setAttribute("AdminLOGIN",admin);
//System.out.println("��ת");
//response.sendRedirect("index.admin");
return"admin/index";
}else{
//response.sendRedirect("login.jsp");
return"admin/login";
}
}
@RequestMapping("/login")
privateStringlogin(){
//System.out.println(username+upass);
//SqlSessionssession=MyBatisTemple.getSession().openSession();
//AdminDaoadmins=ssession.getMapper(AdminDao.class);
//AdminEntityadmin=admins.login(username,upass,0);
//if(admin!
=null){
//System.out
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- java 新闻 项目 Springmvc 框架 结合 使用
![提示](https://static.bdocx.com/images/bang_tan.gif)