这是我的DAL的代码
public readerbean queryreader(String rid) throws Exception {
Connection con = db.Shujuku();
Statement sts = null;
readerbean customer = new readerbean();
try {
sts = con.createStatement();
String sql = "select * from user where readername='" + rid
+ "';";
ResultSet rs = sts.executeQuery(sql);
后面一些代码不用写了大神懂得
}
下面是servlet里的代码
import Dal.queryDal;
import bean.readerbean;
public class QueryuserServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
PrintWriter out = response.getWriter();
readerbean userArray = null; 大约从这里到
queryDal queryreader = new queryDal();
try {
userArray = queryreader.querycomment();这里报错
request.setAttribute("rs", userArray);这里的代码不会写
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
求大神指点下代码要怎么写····
------解决方案--------------------
几个疑问楼主释疑一下
1 楼主的这段代码想要做什么
2 public readerbean queryreader(String rid) throws Exception { 返回的readerbean 是个什么东东呢?
3 userArray = queryreader.querycomment();这里报错 你的queryreader 是个方法,怎么还调用querycomment呢?
4 request.setAttribute("rs", userArray);这里的代码不会写 你要做什么?
------解决方案--------------------
楼主回复人家要引用:
大神收到楼上的通知了么?求验证