页面不能显示

来源:3-5 显示学生资料-页面调用与数据展现

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>

<!-- 遍历结束 -->


写回答 关注

5回答

  • 慕粉15160033427
    2016-08-16 00:35:31
    已采纳

    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>


    jiayy

    非常感谢!

    2016-08-19 17:39:55

    共 1 条回复 >

  • 夏夜的祭
    2017-04-16 16:57:10

    <!-- 遍历开始 -->

    <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

  • LytZz
    2016-08-10 15:10:29

    top.document.frames["MainFrame"].location.href=link; 

    javaScript代码问题,360浏览器不兼容

  • jiayy
    2016-07-24 16:15:46

    右键点击在新窗口可以打开,好奇怪

    Shawn_...

    我用360浏览器遇到和你一样的问题,换成chrome就可以了···

    2016-08-04 19:43:00

    共 1 条回复 >

  • jiayy
    2016-07-24 12:39:06

    数据库里面有内容,怎么都显示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开发学生信息管理功能

Strust2+Hibernate整合开发案例,Java Web开发技能更上一层楼

80701 学习 · 754 问题

查看课程

相似问题