public class StudentsAction extends SuperAction{
private static final long serialVersionUID = 1L;
public String query(){Go
StudentsDAO sdao = new StudentsDAOImpl();
List<Students> list = sdao.queryAllStudents();
if(list!=null&&list.size()>0)
{
session.setAttribute("students_list", list);
}
System.out.println(list.size());
return "query_success";
}
}
struts.xml:
<package name="students" namespace="/students" extends="default">
<action name="*_*" class="action.{1}Action" method="{2}">
<result name="query_success">/students/Students_query_success.jsp</result>
</action>
</package>
tree.jsp:
var treeMenu = [
{ level:1, name:"学生管理"},
{ level:2, name:"学生列表", ico:"images/icon_default.gif",link:"students/Students_query.action"},
{ level:1, name:"教师管理"},
{ level:2, name:"教师列表", ico:"images/icon_default.gif",link:"role_list.html"},
{ level:1, name:"信息管理"},
{ level:2, name:"新闻管理", ico:"images/icon_default.gif",link:"news_list.html"},
{ level:2, name:"公告管理", ico:"images/icon_default.gif",link:"bulletin_list.html"},
{ level:1, name:"系统邮件", ico:"images/icon_default.gif"},
{ level:1, name:"网络文件", ico:"images/icon_default.gif",link:"complaint_list.html"}
];
Student_query_success.jsp:
<!-- 遍历开始 -->
<s:iterator value="#session.students_list" var="stu">
<tr class="list">
<td><s:property value="#stu.sid"/></td>
<td><s:property value="#stu.sname"/></td>
<td><s:property value="#stu.gender"/></td>
<td><s:date name="#stu.birthday" format="yyyy年MM月dd日"/></td>
<td><s:property value="#stu.address"/></td>
<td><a href="#">删除</a></td>
</tr>
</s:iterator>
<!-- 遍历结束 -->
jiayy
相关分类