日期:2014-05-18 浏览次数:20945 次
public class DbUtil {
int i=0,j;
String [][]data = new String[3][3];
Connection con = null;
ResultSet rs=null;
Statement stmt=null;
String drivers = "com.sybase.jdbc3.jdbc.SybDriver";
String url = "jdbc:sybase:Tds:dawnspace:5000/Denglu";
public DbUtil(){
try
{
Class.forName(drivers).newInstance();
con = DriverManager.getConnection(url,"sa","");
stmt = con.createStatement();
}
catch(java.lang.Exception e)
{
e.printStackTrace();
}
}
}
public class DisplayAllAction extends Action{
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response){
ActionErrors errors = new ActionErrors();
if (!errors.isEmpty()) {
saveErrors(request, errors);
return (new ActionForward(mapping.getInput()));
}
HttpSession session = request.getSession();
String[][]data = new String[3][3];
[color=#FF0000]DbUtil db = new DbUtil();[/color]
// data = db.displayall();
session.setAttribute(Constants.DISPLAY_ALL, data);
return (mapping.findForward(Constants.FORWARD_SUCCESS));
}
}