servlet与javabean实现长文本数据分页显示
2008-01-05 18:36:25 来源:WEB开发网这是做wap的时候碰到的问题,您碰到类似的问题可以参考一下!
javabean文件:
DataConnection.java;//数据库连接
BasicInfo.java;//数据bean容器
DataWork.java;//数据操作
servlet文件:
OrderInfoServlet.java;//servlet实现长文本数据分页显示
xml配置文件:
web.xml;//servlet配置
DataConnection.java文件内容为:
package wap_cctv_film;
import java.sql.*;
public class DataConnection {
public static Connection getDataConnection() {
Connection conn = null;
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=wapvod","cctv_sql_user","cctv_sql_user");
}
catch (Exception ex) {
ex.PRintStackTrace();
}
return conn;
}
}
BasicInfo.java文件内容:
package wap_cctv_film;
import java.io.*;
public class BasicInfo
implements Serializable {
private String basicName;
private int basicHits;
private int basicID;
private String basicText;
private int basicIsShow;
private int basicType;
public String getBasicName() {
return basicName;
}
public void setBasicName(String basicName) {
this.basicName = basicName;
}
public int getBasicHits() {
return basicHits;
}
public void setBasicHits(int basicHits) {
this.basicHits = basicHits;
}
public int getBasicID() {
return basicID;
}
public void setBasicID(int basicID) {
this.basicID = basicID;
}
public String getBasicText() {
return basicText;
}
public void setBasicText(String basicText) {
this.basicText = basicText;
}
public int getBasicIsShow() {
return basicIsShow;
}
public void setBasicIsShow(int basicIsShow) {
this.basicIsShow = basicIsShow;
}
public int getBasicType() {
return basicType;
}
public void setBasicType(int basicType) {
this.basicType = basicType;
}
}
DataWork.java文件内容:
package wap_cctv_film;
import java.sql.*;
import java.util.*;
public class DataWork {
private Connection conn;
public DataWork() {
更多精彩
赞助商链接