jiayy
2016-07-24 12:22
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>
<!-- 遍历结束 -->
c标签也是可以的,
<c:forEach items="${sessionScope.list }" var="stu">
<tr class="list">
<td><c:out value="${stu.sid }"></c:out></td>
<td><a href="<%=path%>/students/Students_modify.action?sid=${stu.sid}"><c:out value="${stu.sname }"></c:out></a></td>
<td><c:out value="${stu.gender }"></c:out></td>
<td><c:out value="${stu.birthday }"></c:out></td>
<td><c:out value="${stu.address }"></c:out></td>
<td><a href="<%=path%>/students/Students_delete.action?sid=${stu.sid}" onclick="javascript: return confirm('真的要删除吗?');">删除</a></td>
</tr>
</c:forEach>
<!-- 遍历开始 -->
<s:iterator value="#session.students_list" id="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>
<!-- 遍历结束 -->
把var改成id
top.document.frames["MainFrame"].location.href=link;
javaScript代码问题,360浏览器不兼容
右键点击在新窗口可以打开,好奇怪
数据库里面有内容,怎么都显示0
七月 24, 2016 12:33:10 下午 org.apache.jasper.compiler.TldLocationsCache tldScanJar
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Hibernate: select students0_.SID as SID1_0_, students0_.sname as sname2_0_, students0_.gender as gender3_0_, students0_.birthday as birthday4_0_, students0_.address as address5_0_ from STUDENTS students0_
使用Struts2+Hibernate开发学生信息管理功能
80701 学习 · 754 问题
相似问题