信息發布界面
提供發布信息的交互界面
sayMessage
<HTML> <HEAD> <TITLE> 信息發布</TITLE>
<META content = "text/html; charset=GB
<LINK href ="css_
<META content = "MSHTML
<BODY>
<% @ page contentType=“ text/html; charset=GB
<% @ page language=“ java” import=“ java
<jsp: usebean id ="rencommend" scope="page" class="ymbean
<form action =recordmessage
<input name=dtkey type=hidden value=ta_routes>
<table bgcolor=#d
<tbody>
<tr> <td nowrap width="
<div align=left>
<table bgcolor=#d
<tbody>
<tr> <td nowrap width="
<input maxlength=
</td>
</tr>
<tr><td nowrap width="
<input maxlength=
</td></tr>
<tr>
<td width="
</tr>
<tr><td width="
<TEXTAREA cols=
</TEXTAREA>
</TD>
</TR></TBODY></TABLE></DIV></TD></TR>
<TR><TD align=middle colspan=
<input name=cmdcommit type=submit value="提交">
</td></tr></tbody></table>
</form></center>
<div></div></body></html>
連接數據庫
通過調用 Java Bean連接 Oracle數據庫
opDb
package ymbean; // java包
import java
public class opDb {
public opDb() { }
public ResultSet executeQuery(String sql)
{
ResultSet rs = null;
Statement lstmt = null;
try { lstmt = connectdb();
rs = lstmt
System
} catch(SQLException ex) { return(null)
return rs;
}
public String executeUpdate(String sql)
{
ResultSet rs = null;
Statement lstmt = null;
try {
lstmt = connectdb();
lstmt
System
lstmt
}catch(SQLException ex) {}
return(“ executeUpdate ok” );
}
//連接數據庫
public Statement connectdb()
{ Statement lstmt=null;
Connection conn=null;
final String connect_string=“ jdbc:oracle:thin:scott/tiger@
final String driver_string=“ oracle
OracleDriver” ;
Connection lconn;
try { Class
lconn=DriverManager
lstmt=lconn
} catch (Exception e) { return(null);}
return lstmt;
}
}//end opDb
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19810.html