servlet配置到你的wed.xml中。
从数据库中获取到的数据放进响应中然后通过%=request.getAttribute("bookId1") %获取对应的值当然仅仅有servlet和jsp页面是不够的还须要的是servlet配置到你的wed.xml中。这样servlet才干够使用。
具体代码如下:
package bookConnUtil
import java.io.IOException
import java.sql.SQLException
import javax.servlet.ServletException
import javax.servlet.http.HttpServlet
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
public class selectBook extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// TODO Auto-generated method stub
servlet:String cond = "select * from user_maxiao "
List list = (new UserInfoDAO()).getUser(cond)
request.setAttribute("list", list)
request.setAttribute("user", user)
request.getRequestDispatcher("/person/personlist.jsp").forward(
request, response)
UserInfoDAO:
public List getUser(String cond) {
List list = new ArrayList()
........
return list
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)