struts1练习
(1)点击左侧List中的教师用户管理。
/WebContent/common/pages/left.jsp
<li class="depart"><a href="<%=request.getContextPath() %>/teacher_list.do">教师用户管理</a></li>
(2)根据stucts-config.xml文件中的注册信息请求相应的action。
/WebContent/WEB-INF/stucts-config.xml:
<action path="/teacher_list" type="com.record.web.action.TeacherListAction">
<forward name="teacher_list" path="/pages/teacher_list.jsp"/>
</action>
(3)在action进行取数据,然后进行页面的跳转。
/src/com/***/web/action/TeacherListAction.java
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception
{
request.setAttribute("teacher_list", teacher_list);
return mapping.findForward("teacher_list");
}
(4)显示List。
/WebContent/pages/teacher_list.jsp

浙公网安备 33010602011771号