?? complete.java
字號(hào):
/*
* Created on 2004-9-24
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package com.bumf;
import oa.sys.*;
import oa.sys.Time;
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
****************************************************
*類名稱: Complete<br>
*類功能: 公文處理(附件)<br>
*創(chuàng)建: 白偉明 2004年10月9日<br>
****************************************************
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class Complete extends HttpServlet{
private int examine;
private String bumf;
private String sqlu;
private String submit;
private String sqli;
private HttpSession session=null;
private ResultSet rs=null;
private Statement stmt=null;
private int temp,id,bumfid;
public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException{
request.setCharacterEncoding("gb2312");
response.setContentType("text/html; charset=gb2312");
PrintWriter out=response.getWriter();
session=request.getSession();
Str str=new Str();
Db db=new Db();
Time time=new Time();
//獲取處理人id
try{
id=Integer.parseInt((String)session.getAttribute("id"));
}catch(Exception e){
id=0;
// e.printStackTrace();
// request.setAttribute("ok","您的網(wǎng)頁(yè)已過(guò)期請(qǐng)重新登錄");
}
//獲取基本信息
try{
bumfid=Integer.parseInt((String)request.getParameter("bumfid"));
}catch(Exception e){
e.printStackTrace();
}
bumf=request.getParameter("bumf");
submit=request.getParameter("Submit");
if(submit.equals("處理完成")){
examine=1;
}else{
examine=0;
}
out.print(examine);
if(examine==0){
//保存
sqlu="UPDATE bumf SET time='"+time.getYMDHMS()+"',content='"+bumf+"',examine="+examine+" WHERE bumfid="+bumfid;
try{
stmt=db.getStmt();
temp=stmt.executeUpdate(sqlu);
if(temp>0){
request.setAttribute("ok","操作成功");
}else{
request.setAttribute("ok","操作失敗");
}
}catch(Exception e){
e.printStackTrace();
}finally{
db.close();
}
}else{
//發(fā)送
sqlu="UPDATE bumf SET time='"+time.getYMDHMS()+"',content='"+bumf+"',examine="+examine+" WHERE bumfid="+bumfid;
try{
stmt=db.getStmt();
temp=stmt.executeUpdate(sqlu);
if(temp>0){
request.setAttribute("ok","操作成功");
}else{
request.setAttribute("ok","操作失敗");
}
}catch(Exception e){
e.printStackTrace();
}finally{
db.close();
}
}
RequestDispatcher dispatcher=request.getRequestDispatcher("accept");
dispatcher.forward(request,response);
}
public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException{
doPost(request,response);
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -