• 大小: 2.33MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-27
  • 语言: Java
  • 标签: javaee  blog  mvc  博客开发  

资源简介

基于BootStrap3的javaee blog mvc版 博客开发,带数据库,tomcat7.0,jdk1.8,mysql可运行,eclipse项目

资源截图

代码片段和文件信息

package cap.action;

import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import cap.bean.Admin;
import cap.bean.Article;
import cap.bean.Comment;
import cap.bean.Counter;
import cap.bean.Profile;
import cap.bean.SysCategory;
import cap.bean.User;
import cap.service.AdminService;
import cap.service.ArticleService;
import cap.service.CommentService;
import cap.service.CounterService;
import cap.service.ProfileService;
import cap.service.SysCategoryService;
import cap.service.UserService;
import cap.service.impl.AdminServiceImpl;
import cap.service.impl.ArticleServiceImpl;
import cap.service.impl.CommentServiceImpl;
import cap.service.impl.CounterServiceImpl;
import cap.service.impl.ProfileServiceImpl;
import cap.service.impl.SysCategoryServiceImpl;
import cap.service.impl.UserServiceImpl;
import cap.util.PageControl;


@WebServlet(“/admin.html“)
public class AdminServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private AdminService adminService;
private UserService userService;
private ProfileService profileService;
private ArticleService artService;
private SysCategoryService scService;
private CounterService cntService;
private CommentService cmtService;
       
    
    public AdminServlet() {
     adminService=new AdminServiceImpl();
     userService=new UserServiceImpl();
     profileService=new ProfileServiceImpl();
     artService=new ArticleServiceImpl();
     scService=new SysCategoryServiceImpl();
     cntService=new CounterServiceImpl();
     cmtService=new CommentServiceImpl();
    }


protected void doGet(HttpServletRequest request HttpServletResponse response) throws ServletException IOException {
this.doPost(request response);
}


protected void doPost(HttpServletRequest request HttpServletResponse response) throws ServletException IOException {

response.setContentType(“text/html“);
request.setCharacterEncoding(“UTF-8“);
String action=request.getParameter(“action“);
if(action.equals(“login“)){
String userName = request.getParameter(“username“);
String passWord = request.getParameter(“password“);

Admin admin = adminService.login(userName passWord);

if (admin == null) {
request.getSession().setAttribute(“msg“ “用户名或密码不正确!“);
response.sendRedirect(“AdminLogin.jsp“);
} else {
request.getSession().setAttribute(“admin“ admin);
response.sendRedirect(“admin.html?action=index“);
}

}else if(action.equals(“logout“)){
HttpSession session = request.getSession(false);    //防止创建Session

if (null != session) {
session.removeAttribute(“admin“);
}

request.getSession().setAttribute(“logoutMs

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-12-26 22:05  blog\
     文件         539  2014-12-09 10:38  blog\.classpath
     文件        1037  2014-05-14 21:42  blog\.project
     目录           0  2017-12-26 22:05  blog\.settings\
     文件         503  2014-05-14 21:42  blog\.settings\.jsdtscope
     文件          48  2014-05-15 11:30  blog\.settings\org.eclipse.core.runtime.prefs
     文件         598  2014-12-09 10:47  blog\.settings\org.eclipse.jdt.core.prefs
     文件         464  2014-05-14 21:42  blog\.settings\org.eclipse.wst.common.component
     文件         345  2014-09-15 21:33  blog\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2014-05-14 21:42  blog\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2014-05-14 21:42  blog\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2017-12-26 22:05  blog\WebContent\
     文件        6658  2014-09-16 16:15  blog\WebContent\AddArtical.jsp
     文件        4673  2014-09-16 15:29  blog\WebContent\AddCategory.jsp
     文件        3165  2014-09-16 15:29  blog\WebContent\AdminLogin.jsp
     文件        4662  2014-09-16 16:19  blog\WebContent\ApplyBlog.jsp
     文件        6783  2014-09-16 16:16  blog\WebContent\ArticleManage.jsp
     文件        5836  2014-09-16 15:30  blog\WebContent\BlogInfo.jsp
     文件        7609  2014-09-16 16:20  blog\WebContent\CategoryManage.jsp
     文件        6129  2014-09-16 15:30  blog\WebContent\CommentManage.jsp
     文件        4792  2014-09-16 15:30  blog\WebContent\EditCategory.jsp
     文件        2927  2015-06-25 16:55  blog\WebContent\Login.jsp
     目录           0  2017-12-26 22:05  blog\WebContent\meta-INF\
     文件          36  2014-05-14 21:46  blog\WebContent\meta-INF\MANIFEST.MF
     文件         381  2015-06-25 17:19  blog\WebContent\meta-INF\context.xml
     文件        7707  2014-09-16 15:30  blog\WebContent\MyBlogIndex.jsp
     文件        7597  2014-09-16 15:31  blog\WebContent\Post.jsp
     文件       10092  2014-09-16 15:31  blog\WebContent\Profile.jsp
     文件        3939  2014-09-16 15:31  blog\WebContent\Register.jsp
     文件        4658  2014-09-16 16:19  blog\WebContent\SearchResult.jsp
     文件        8800  2014-09-16 15:31  blog\WebContent\UpdateArtical.jsp
............此处省略181个文件信息

评论

共有 条评论