这是做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() {