Servlet转发到JSP,JSP取出值输出不显示问题

Servlet代码

//DAO取数据

List list = sDao.findAllDishes();

//将其放到request的域中

request.setAttribute("dishesList", list);




JSP代码

        <%
request.setCharacterEncoding("utf-8");
List list = (List) request.getAttribute("dishesList");

%>

//这里的list控制台打印有值

//但是JTSL输出不了

        



${Dishes.dishesName}


DBUG

//包导了//没写错

so google

//在jsp的<%%>中将LIST存入Page域

//取出 成了

items="${cg}" 你把cg放到某个scope下。再在scope中读出来。比如:pageContext.setAttribute("liset",liset);

ody>
<%
request.setCharacterEncoding("utf-8");
List list = (List) request.getAttribute("dishesList");
pageContext.setAttribute("list",list);
%>



${Dishes.dishesName}


//mark





你可能感兴趣的:(Servlet转发到JSP,JSP取出值输出不显示问题)