java前台表格跟数据连接?

来源:百度知道 编辑:UC知道 时间:2024/05/28 03:14:45
myeclipse跟oracle数据库``想在前台表格里显示后台数据怎么实现?

有没有想应的实例发个给我``还是帮我找找看``
以前没接触不会```
请大伙帮帮忙```对我有帮助``必给重谢
要是你们有相应的例子可以发给我参考更好了我的邮箱是:jiajia288@126.com
..Table

/*Java连接oracle数据库*/
你自己先建一个名叫soft的数据库,在建一个student的数据库表
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.soft.dto.StudentDTO;
//DAO封装的是对数据库的操作
public class StudentDAO
{
//getAll()方法得到数据库中的所有数据
public List getAll()
{
Connection conn=null;
List<StudentDTO> students=new ArrayList<StudentDTO>();
try {
/*加载oracle数据库驱动*/
Class.forName("oracle.jdbc.driver.OracleDriver");
/*获得数据库的连接*/
conn=DriverManager.getConnection("jdbc:oracle:@localhost:1521:soft","root","1234");
/*预处理语句*/
PreparedStatement ps=conn.prepareStatement("select stuid,stuname,stuage from student");
/*得到结果集*/
ResultSet rs=ps.executeQuery();
wh