【Java开源代码栏目提醒】:网学会员在Java开源代码频道为大家收集整理了Accept.java提供大家参考,希望对大家有所帮助!
/*
* 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.data.Bumf;
import oa.sys.*;
import oa.sys.Time;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
****************************************************
*绫诲悕绉帮細 Accept<br>
*绫诲姛鑳斤細 鍏枃鎺ユ敹(闄勪欢)<br>
*鍒涘缓锛?鐧戒紵鏄?2004骞?0鏈?鏃?br>
****************************************************
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class Accept extends HttpServlet{
private int count;
private int sign;
private int examine;
private int id;
private int accepter;
private int sendter;
private int bumfid;
private String axffix;
private String content;
private String title;
private String time;
private String sqls;
private String sqli;
private String submit;
private String bumf;
private HttpSession session=null;
private ResultSet rs=null;
private Statement stmt=null;
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 times=new Time();
Collection coll=new ArrayList();
//鑾峰彇鍙戦佷汉id
try{
id=Integer.parseInt((String)session.getAttribute("id"));
}catch(Exception e){
// e.printStackTrace();
request.setAttribute("msg","鎮ㄧ殑缃戦〉宸茶繃鏈熻閲嶆柊鐧诲綍");
id=0;
}
//鏌ョ湅鎺ュ彈浜烘槸鍚︽湁鏂扮殑鍏枃
count=db.getRowCount("bumf WHERE accepter="+id+" AND sign="+1+" AND examine="+0);
if(count>0){
request.setAttribute("count",new Integer(count).toString());
}
sqls="SELECT * FROM bumf WHERE accepter="+id+" AND sign="+1+" AND examine="+0+" ORDER BY bumfid";
try{
stmt=db.getStmtread();
rs=stmt.executeQuery(sqls);
if(rs.next()){
bumfid=rs.getInt(1);
sendter=rs.getInt(2);
accepter=rs.getInt(3);
title=rs.getString(4);
time=rs.getString(5);
content=rs.getString(6);
axffix=rs.getString(7);
examine=rs.getInt(8);
sign=rs.getInt(9);
content=str.outStr(content);
axffix=str.outStr(axffix);
Bumf bumf=new Bumf();
bumf.setId(bumfid);
bumf.setSendter(sendter);
bumf.setAccepter(accepter);
bumf.setTitle(title);
bumf.setTime(time);
bumf.setContent(content);
bumf.setExamine(examine);
bumf.setSign(sign);
bumf.setAffix(axffix);
coll.add(bumf);
}
request.setAttribute("msg",coll);
}catch(Exception e){
e.printStackTrace();
}finally{
db.close();
RequestDispatcher dispatcher=request.getRequestDispatcher("accept.jsp");
dispatcher.forward(request,response);
}
}
public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException{
doPost(request,response);
}
}
上一篇:
Accept.java
下一篇:
论英语教学中的文化意识渗透