• 大小: 2.23MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-28
  • 语言: Java
  • 标签: 个人博客  

资源简介

JSP+servlet+Bbootstrap博客论坛源码,根目录有数据库SQL文件直接导入表即可。

资源截图

代码片段和文件信息

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

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        539  2014-12-09 10:38  blog(EL版本)\blog\.classpath

     文件       1037  2014-05-14 21:42  blog(EL版本)\blog\.project

     文件        503  2014-05-14 21:42  blog(EL版本)\blog\.settings\.jsdtscope

     文件         48  2014-05-15 11:30  blog(EL版本)\blog\.settings\org.eclipse.core.runtime.prefs

     文件        598  2014-12-09 10:47  blog(EL版本)\blog\.settings\org.eclipse.jdt.core.prefs

     文件        464  2014-05-14 21:42  blog(EL版本)\blog\.settings\org.eclipse.wst.common.component

     文件        345  2014-09-15 21:33  blog(EL版本)\blog\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2014-05-14 21:42  blog(EL版本)\blog\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2014-05-14 21:42  blog(EL版本)\blog\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       8307  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\action\AdminServlet.class

     文件       5257  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\action\ArticleServlet.class

     文件       4640  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\action\CategoryServlet.class

     文件       5533  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\action\CommentServlet.class

     文件       1506  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\action\CounterServlet.class

     文件       2625  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\action\IndexServlet.class

     文件      10640  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\action\UserServlet.class

     文件        713  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\bean\Admin.class

     文件       3158  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\bean\Article.class

     文件       1316  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\bean\BlogInfo.class

     文件       1321  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\bean\Category.class

     文件       1563  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\bean\Comment.class

     文件        466  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\bean\Counter.class

     文件       1489  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\bean\Profile.class

     文件       1142  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\bean\SysCategory.class

     文件       1563  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\bean\Ucomment.class

     文件       1483  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\bean\User.class

     文件        178  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\dao\AdminDao.class

     文件       1050  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\dao\ArticleDao.class

     文件        269  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\dao\BlogInfoDao.class

     文件        645  2017-05-06 13:06  blog(EL版本)\blog\build\classes\cap\dao\CategoryDao.class

............此处省略186个文件信息

评论

共有 条评论