java手机论坛开源代码 java开发论坛网站( 五 )


protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
processRequest(request, response);
}
protected void getDsnConn(){
String sqlUrl="jdbc:mysql://10.0.0.1/你申请用户名?user=你的名字password=你的帐号";
try{
if(debug)
conn=DriverManager.getConnection("jdbc:odbc:ODBC源","用户名","密码口令");
else
conn=DriverManager.getConnection(sqlUrl);
}
catch(SQLException es){
System.err.println("和库连接时出错:"+es.getMessage());
}
}
protected void executeInsert(String sqlStr){
try{
Statement stmt=conn.createStatement();
stmt.executeUpdate(sqlStr);
}
catch(SQLException es){
System.err.println("执行插入时:"+es.getMessage());
}
}
protected void executeUpdate(String sqlStr){
try{
Statement stmt=conn.createStatement();
stmt.executeUpdate(sqlStr);
}
catch(SQLException e){
System.err.println("error in query record");
}
}
//查寻
protected ResultSet executeQuery(String sqlStr){
rs=null;
try{
Statement stmt=conn.createStatement();
rs=stmt.executeQuery(sqlStr);
}
catch(SQLException ex){
System.err.println("执行查寻出错:"+ex.getMessage());
}
return rs;
}
protected ResultSet executeScrollableQuery(String sqlStr){
rs=null;
try{
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs=stmt.executeQuery(sqlStr);
}
catch(SQLException e){
System.err.println("执行动态查寻出错");
}
return rs;
}
//得到表记录总数
protected int getRecordCount(String sTableName){
rs=null;
int CountResult=0;
String sqlStr="select count(*) from "+sTableName;
try{
Statement stmt=conn.createStatement();
rs=stmt.executeQuery(sqlStr);
if(rs.next())
CountResult=rs.getInt(1);
rs=null;
stmt.close();
}
catch(SQLException ex){
System.err.println(ex.getMessage());
}
return CountResult;
}
//得到记录总页数
protected int getTotalPage(String sTableName,int iPageSize){
int totalPage;
int totalRecNum=getRecordCount(sTableName);
if(totalRecNum%iPageSize==0)
totalPage=totalRecNum/iPageSize;
else
totalPage=totalRecNum/iPageSize+1;
return totalPage;
}
protected String convert(String InputStr){
String converted=new String();
byte[] bytes;
try{
bytes=InputStr.getBytes("ISO8859-1");
converted=new String(bytes,"GB2312");
}
catch(java.io.UnsupportedEncodingException e){
System.out.print("error");
}
return converted;
}
/** Returns a short description of the servlet.
*/
public String getServletInfo() {
return "Short description";
}
}
都说java是开源,怎么样才能找到java的开源项目代码?。坎恢滥男┩镜目聪钅亢痛攵嘈?,谢谢java开源的项目,你需要哪些方便的呢 , 公司用的比较多的是apache 提供的一些项目 , 这些项目是有人维护的,这些才能称为开源的项目,比如apache ftp,等等
【java手机论坛开源代码 java开发论坛网站】java手机论坛开源代码的介绍就聊到这里吧 , 感谢你花时间阅读本站内容,更多关于java开发论坛网站、java手机论坛开源代码的信息别忘了在本站进行查找喔 。

推荐阅读