<tr>
<th>宸ュ彿</th>
<th>濮撳悕</th>
<th>宸ヤ綔</th>
<th>騫撮檺</th>
<th>宸ヨ祫</th>
</tr>
<logic:iterate id="emp" name="list"> <td><bean:write name="emp" property="Empno"/></td>
<td><bean:write name="emp" property="Ename"/></td>
<td><bean:write name="emp" property="Job"/></td>
<td><bean:write name="emp" property="Hiredate"/></td>
<td><bean:write name="emp" property="Sal"/></td>
</logic:iterate>
</table>
</body>
--------------------------------------------------------------------------------------------------
public class QueryAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
EmpDao empDao = new EmpDao();
ArrayList list = empDao.empName();
//System.out.println(list);
request.setAttribute("list", list);
return new ActionForward("/display.jsp");
}
}
- <logic:iterate id="emp" name="list">
<logic:iterate id="emp" name="list">
name灞炴э細鏄綘鏀劇疆Bean鐨勯泦鍚堬紝鍦ㄤ綘鐨勮繖孌典唬鐮佷腑錛?
- public class QueryAction extends Action {
-
- public ActionForward execute(ActionMapping mapping, ActionForm form,
- HttpServletRequest request, HttpServletResponse response) {
-
- EmpDao empDao = new EmpDao();
- ArrayList list = empDao.empName();
-
- request.setAttribute("list", list);
-
- return new ActionForward("/display.jsp");
- }
- }
public class QueryAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
EmpDao empDao = new EmpDao();
ArrayList list = empDao.empName();
//System.out.println(list);
request.setAttribute("list", list);
return new ActionForward("/display.jsp");
}
}
- request.setAttribute("list", list);
request.setAttribute("list", list);
浣犳槸灝唋ist鏀懼叆鍒皉equest鑼冨洿鍐咃紝瀵瑰簲鐨勫悕瀛楁槸list錛屽鏋滀綘瑕佹槸鍐欐垚
- request.setAttribute("myList", list);
request.setAttribute("myList", list);
,閭d箞錛宭ogic:iterator涓殑name灞炴у氨瑕佷負"myList"錛?
logic:iterator涓殑id灞炴э紝鍏跺疄鏄綘瑕佷粠浣犵殑闆嗗悎涓彇鍑虹殑Bean鐨勫悕瀛楋紝榪欎釜鍚嶅瓧鏄換鎰忚搗鐨勶紝涓昏鏄笅闈㈢殑<bean:write name="emp" property="Ename"/>鏍囩涓殑name灞炴ц璺焞ogic:iterator涓殑id灞炴у搴斾笂錛庡叾瀹炶繖閲岀殑鏄繖鏍風殑錛岄鍏?lt;logic:iterator>鏍囩浼氭妸name灞炴у間負list鐨勯泦鍚堥噷鐨刡ean閫愪竴鍙栧嚭鏉ワ紝姣忓彇鍑烘潵涓涓紝灝辨妸浠栧瓨鍒板悕涓篿d灞炴х殑鍊肩殑pageContext鑼冨洿鍐咃紝涓鐪嬩唬鐮佷綘灝辮兘鏄庣櫧錛?
涓昏浠g爜錛?
-
-
- List list=request.getAttribute("list");
-
- pageContext.setAttribute("emp",bean);
-
- pageContext.getAttribute("emp");

]]>