?? inserttest.java
字號(hào):
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.*;
public class InsertTest 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 {
DataBean db=new DataBean();
TestBean tb=new TestBean();
tb.setTest_Result(request.getParameter("Test_Result"));
tb.setTest_Score(Integer.parseInt(request.getParameter("Test_Score")));
tb.setTest_Theme(request.getParameter("Test_Theme"));
tb.setTest_Type(request.getParameter("Test_Type"));
if(tb.getTest_Type().equals("1"))
{
tb.setTest_A(request.getParameter("A"));
tb.setTest_B(request.getParameter("B"));
tb.setTest_C(request.getParameter("C"));
tb.setTest_D(request.getParameter("D"));
}
if(db.insertTest(tb))
{
request.setAttribute("alert","alert('錄入成功')");
}else
{
request.setAttribute("alert","alert('錄入失敗')");
}
db.Close();
request.getRequestDispatcher("index.jsp?action=1").forward(request, response);
}
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
doGet(request, response);
}
//Clean up resources
public void destroy() {
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -