request.setAttribute("listItem",listItem);在jsp页面用forEach和EL表达式接受不到list里面元素属性
用request.getSession().setAttribute("listItem",listItem;就可以。Servlet:List<ItemBean>list...
用request.getSession().setAttribute("listItem",listItem;就可以。
Servlet:
List<ItemBean> listItem = ItemDao.getItems("");
List<UserBean> listUser = UserDao.queryAll("");
request.setAttribute("listItem", listItem);
request.setAttribute("listUser", listUser);
response.sendRedirect(path + "/jsps/account/accountAdd.jsp");
JSP:
<select class="inp001" name="itemDetails" style="border: 1px solid black;">
<c:forEach items="${listItem}" var="item">
<option value="${item.itemDetails }">${item.itemDetails }</option>
</c:forEach>
</select> 展开
Servlet:
List<ItemBean> listItem = ItemDao.getItems("");
List<UserBean> listUser = UserDao.queryAll("");
request.setAttribute("listItem", listItem);
request.setAttribute("listUser", listUser);
response.sendRedirect(path + "/jsps/account/accountAdd.jsp");
JSP:
<select class="inp001" name="itemDetails" style="border: 1px solid black;">
<c:forEach items="${listItem}" var="item">
<option value="${item.itemDetails }">${item.itemDetails }</option>
</c:forEach>
</select> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询