我对 tomcat 和 android 非常陌生,所以我正在尝试读取 servlet 文件,但有一些错误..需要帮助。谢谢!(我想做的是从 tomcat 数据库中读取名称)。
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);
}
}