这是Servlet方法 public class TypeServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Typedao typedao=new Typedao(); List<Type> allType=typedao.getAllType(); req.getSession().setAttribute("allType",allType); req.getRequestDispatcher("/data/getType.jsp").forward(req,resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { this.doGet(req,resp); } }
这是JSP
<% List<Type> allType= (List<Type>)session.getAttribute("allType"); Iterator<Type> it=allType.iterator(); while (it.hasNext()){ Type type= it.next(); %> <a href="getNotice.jsp?tno=<%=type.getTno()%>"><%=type.getTtypeName()%></a><br/> <% } %>
为啥没有传过来