0
我對tomcat和android非常陌生,所以我想讀取servlet文件,但有一些錯誤..需要幫助。謝謝! (我想要做的是從tomcat數據庫中讀取名稱)。android tomcat讀取servlet字符串文本
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
Statement stmt;
ResultSet rs=null;
String name="";
try {
stmt = con.createStatement();
rs = stmt.executeQuery("SELECT * FROM team7");
while(rs.next()){
name=rs.getString("");
}
}
catch (Exception e) { }
try { rs.close(); } catch (SQLException e) { }
PrintWriter out = resp.getWriter();
out.println(name);
}
}