createtests.java

来自「jdom开发一个考试系统」· Java 代码 · 共 82 行

JAVA
82
字号
/*<%--////////////////////////////////////////////////////GTON原创作品-XML考试系统//////////////////////////////////////////////////////////////
////////////所用技术:jsp2.0+servlet2.4+jstl1.1+JDOM+DOM+sqlserver2000+tomcat5.5/////////////////////////////////////
/////////////////////////////////////////////////////专业制作网站 专业制作毕业设计////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////QQ:27612285//////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////Mail:punkwang@126.com////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////WEB:www.98202.com www.630cn.com//////////////////////////////////////////////////////
////////////////////////////////////////////////////qq群:20665503////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////求高薪工作一个有意者联系本人/////////////////////////////////////////////////////////
////////////////////////////////////////////////////Phone:010-81110277(王先生)///////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--%>
<%--接 毕业设计业务 网站业务 商业网站 个人网站 商城系统 企业主页 JSP ASP.net PHP !!! 

业务种类 

网站业务: 商业网站 个人网站 商城系统 企业主页 等中小型网站(asp, jsp ,php ,asp.net) 

毕业设计业务:java(j2ee j2se) vb delphi php .net等毕设业务 

模块业务:各种中小型模块 java .net 

如有需要 价格细谈 QQ:27612285 

我的网站 
HTTP://www.98202.com 
HTTP://www.do3w.com 
HTTP://www.201cn.com 
HTTP://www.630cn.com--%>
*/package com.gton.servlet.admin;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import com.gton.bean.*;
import com.gton.bean.db.*;
import com.gton.util.*;
public class CreateTests extends HttpServlet {
    private static final String CONTENT_TYPE = "text/html; charset=GBK";

    //Initialize global variables
    public void init() throws ServletException {
    }

    //Process the HTTP Get request
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws
            ServletException, IOException {
        int oneCount=Integer.parseInt(request.getParameter("OneCount"));
        int mCount=Integer.parseInt(request.getParameter("MCount"));
        DataBean db=new  DataBean();
        ArrayList list=new ArrayList();
        list.addAll(db.getTestList(oneCount,"1"));
        list.addAll(db.getTestList(mCount,"0"));
        MyXML xml=new MyXML();
        String date=MyDate.getDate();
        TestsBean tsb=new TestsBean();
        tsb.setTests_Time(date);
        tsb.setTests_Path(xml.outXMLFile(list,date));
        if(db.InsertTests(tsb))
        {
            request.setAttribute("alert","alert('生成成功')");
        }else
        {
            request.setAttribute("alert","alert('生成失败')");
        }
           request.getRequestDispatcher("index.jsp?action=2").forward(request, response);

        db.Close();
    }

    //Process the HTTP Post request
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws
            ServletException, IOException {
        doGet(request, response);
    }

    //Clean up resources
    public void destroy() {
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?