• 大小: 2.9MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-07
  • 语言: Java
  • 标签: Jsp  系统  

资源简介

采用三层构架,博客名字和数据库连接字符串可以在web.xml中改,基于Jsp+MySql开发,使用前先在MySql中运行blog_data.sql或配置Odbc数据源,数据库在网站的database目录

资源截图

代码片段和文件信息

/*
 * To change this template choose Tools | Templates
 * and open the template in the editor.
 */

package moscue.blog.cl;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import moscue.blog.dal.*;

/**
 *
 * @author Will
 */
public class AddClass extends HttpServlet {
   
    /** 
     * Processes requests for both HTTP GET and POST methods.
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    protected void processRequest(HttpServletRequest request HttpServletResponse response)
    throws ServletException IOException {
        response.setContentType(“text/html;charset=gb2312“);
        request.setCharacterEncoding(“gb2312“);
        response.setCharacterEncoding(“gb2312“);
        PrintWriter out = response.getWriter();
        /*TODO:验证管理员会话...*/
        HttpSession session=request.getSession();
        String strId=session.getAttribute(“uid“).toString();
        if(strId==null){
            out.println(“YOU don‘t have the power!GO TO INDEX“);
            return;
        }
        int uid=Integer.parseInt(strId);
        User user=new User();
        UserOper userOper=new UserOper();
        user=userOper.getUserById(uid);
        int level=user.getLevel();
        if(level>0&&level<3){
            String title=request.getParameter(“txttitle“);
            ClassOper classOper=new ClassOper();
            if(classOper.insertClass(title))
                out.println(“Sucessfully add a classGO TO CLASS ADMIN PAGE“);
        }
        else
        {
            out.println(“YOU don‘t have the power!GO TO INDEX“);
        }
        try {
            /* TODO output your page here
            out.println(““);
            out.println(““);
            out.println(“tle>Servlet AddClasstle>“);  
            out.println(““);
            out.println(““);
            out.println(“

Servlet AddClass at “ + request.getContextPath () + “

“);
            out.println(““);
            out.println(““);
            */
        } finally { 
            out.close();
        }
    } 

    // 
    /** 
     * Handles the HTTP GET method.
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doGet(HttpServletRequest request HttpServletResponse response)
    throws ServletException 

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

     文件       6499  2009-06-03 00:55  mblog\blog_data.sql

     文件       9799  2009-06-03 22:56  mblog\build\web\addtips.jsp

     文件       8163  2009-06-03 22:56  mblog\build\web\admin.jsp

     文件       7075  2009-06-03 22:56  mblog\build\web\allTips.jsp

     文件       9355  2009-06-03 22:56  mblog\build\web\changePwd.jsp

     文件       9925  2009-06-03 22:56  mblog\build\web\classAdmin.jsp

     文件       3888  2009-06-03 22:56  mblog\build\web\css\style.css

     文件       3008  2009-06-03 22:56  mblog\build\web\data\blog_data.ldb

     文件     212992  2009-06-03 22:56  mblog\build\web\data\blog_data.mdb

     文件        299  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\about.gif

     文件        219  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\abspos.gif

     文件        237  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\anchor.gif

     文件        125  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\art.gif

     文件        162  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\backcolor.gif

     文件        253  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\backward.gif

     文件        285  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\bgcolor.gif

     文件        272  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\bgpic.gif

     文件         88  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\blink.gif

     文件         76  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\bold.gif

     文件        267  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\br.gif

     文件         71  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\checked.gif

     文件        210  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\code.gif

     文件        156  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\componentmenu.gif

     文件        262  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\copy.gif

     文件        233  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\createlink.gif

     文件        202  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\css.gif

     文件        229  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\cut.gif

     文件        306  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\date.gif

     文件         95  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\delete.gif

     文件        186  2009-06-03 22:56  mblog\build\web\editor\buttonimage\blue\editmenu.gif

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

评论

共有 条评论