jsp页面:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>所有已同意列表</title>
<Meta http-equiv="pragma" content="no-cache">
<Meta http-equiv="cache-control" content="no-cache">
<Meta http-equiv="expires" content="0">
<Meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<Meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<link href="${pageContext.request.contextPath}/image/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/javascript/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
//setMenuHeight
$('.menu').height($(window).height()-51-27-26);
$('.sidebar').height($(window).height()-51-27-26);
$('.page').height($(window).height()-51-27-26);
$('.page iframe').width($(window).width()-15-168);
//menu on and off
$('.btn').click(function(){
$('.menu').toggle();
if($(".menu").is(":hidden")){
$('.page iframe').width($(window).width()-15+5);
}else{
$('.page iframe').width($(window).width()-15-168);
}
});
//
$('.subMenu a[href="#"]').click(function(){
$(this).next('ul').toggle();
return false;
});
})
</script>
</head>
<body>
<div id="wrap">
<div id="header">
<div class="logo fleft"></div>
<a class="logout fright" href="login.html"> </a>
<div class="clear"></div>
<div class="subnav">
<div class="subnavLeft fleft"></div>
<div class="fleft"></div>
<div class="subnavRight fright"></div>
</div>
</div><!--#header -->
<div id="content">
<div class="space"></div>
<div class="menu fleft">
<ul>
<li class="subMenuTitle">功能菜单</li>
<li class="subMenu"><a href="#">请假管理</a>
<ul>
<li><a href="${pageContext.request.contextPath}/pages/TeacherAction!getAllLeave.do">所有假单</a></li>
<li><a href="${pageContext.request.contextPath}/pages/TeacherAction!getAllnoragreeLeave.do">待审批假单</a></li>
<li><a href="${pageContext.request.contextPath}/pages/TeacherAction!getAllAgreeLeave.do">已同意假单</a></li>
<li><a href="${pageContext.request.contextPath}/pages/TeacherAction!getAllDisagreeLeave.do">不同意假单</a></li>
</ul>
</li>
<li class="subMenu"><a href="#" target="right">个人信息管理</a></li>
</ul>
</div>
<div class="sidebar fleft"><div class="btn"></div></div>
<div class="page">
<h6 align="center">已审批同意假单列表</h6>
<table width="80%" border="1" cellpadding="0" style="border-collapse:collapse;" bordercolor="#000000">
<tr>
<th align="center">序号</th>
<th align="center">学生名字</th>
<th align="center">学生编号</th>
<th align="center">班级</th>
<th align="center">请假原因</th>
<th align="center">请假开始时间</th>
<th align="center">请假结束时间</th>
<th align="center">状态</th>
</tr>
<s:iterator value="leavelist" status="list" >
<tr>
<s:hidden name="id" value="leaveId"></s:hidden>
<td align="center" ><s:property value="#list.getIndex()+1"/></td>
<td align="center" ><s:property value="stuName" /></td>
<td align="center"><s:property value="stuId" /></td>
<td align="center"><s:property value="class_" /></td>
<td align="center"><s:property value="leaveReason" /></td>
<td align="center"><s:property value="leaveDate" /></td>
<td align="center"><s:property value="leaveTime" /></td>
<td align="center">已同意 <a href="${pageContext.request.contextPath}/pages/TeacherAction!disagreeLeave.do?leaveId=${leaveId}">更改为不同意</a></td>
</tr>
</s:iterator>
</table>
共<s:property value="totalCount" />条假单
第<s:property value="currentPage" />页 共<s:property value="totalPage" />页
<%-- 输出页面跳转代码,分链接和静态文字两种 --%>
<s:if test="currentPage > 1">
<a href="${pageContext.request.contextPath}/pages/TeacherAction!getAllAgreeLeave.do?page=${ currentPage-1}">上一页</a>
</s:if>
<s:if test="currentPage < totalPage">
<a href="${pageContext.request.contextPath}/pages/TeacherAction!getAllAgreeLeave.do?page=${currentPage+1}">下一页</a>
</s:if>
<%-- 输出 JavaScript 跳转代码 --%>
<script>
// 页面跳转函数
// 参数: 包含页码的表单元素,例如输入框,下拉框等
function jumpPage(input) {
// 页码相同就不做跳转
//if(input.value == ${currentPage}) {
// return;
// }
var newUrl = "${pageContext.request.contextPath}/pages/TeacherAction!getAllAgreeLeave.do?page=" + input.value;
document.location = newUrl;
}
</script>
转到
<!-- 输出 HTML SELECT 元素,并选中当前页面编码 -->
<select onchange='jumpPage(this);'>
<s:bean name="org.apache.struts2.util.Counter" id="counter">
<s:param name="first" value="1" />
<s:param name="last" value="totalPage" />
<s:iterator>
<option value="<s:property/>"
<s:if test="currentPage == currenter -1">selected</s:if>>
<s:property/>
</option>
</s:iterator>
</s:bean>
</select>
输入页码:<input type="text" value="${currentPage}" id="jumpPageBox" size="3">
<input type="button" value="跳转" onclick="jumpPage(document.getElementById('jumpPageBox'))"/>
</div>
</div><!--#content -->
<div class="clear"></div>
<div id="footer"></div><!--#footer -->
</body>
</html>
struct.xml:
<!-- 使用通配符,一个表达完了namespace -->
<package name="econWarnAjax" namespace="/Ajax" extends="json-default">
<!-- 通过URL访问的路径是 /namesapce/Entity/method.do -->
<action name="*/*/*/*" method="{4}" class="com.gxuwz.econWarn.{1}.{2}.Ajax.{3}Action">
<result type="json"></result>
</action>
</package>
action:
/** * (指标管理页面)获取二级、三级菜单 * * @return */ public String openEconIndexAllMag() { System.out.println("执行Ajax,且indexId=" + indexId); System.out.println("执行Ajax,且oneEconIndexIdstr=" + oneEconIndexIdstr); System.out.println("执行Ajax,且twoEconIndexIdstr=" + twoEconIndexIdstr); String strTem = ""; if (null != oneEconIndexIdstr && !"".equals(oneEconIndexIdstr) && !"null".equals(oneEconIndexIdstr)) { strTem = oneEconIndexIdstr; } if (null != twoEconIndexIdstr && !"".equals(twoEconIndexIdstr) && !"null".equals(twoEconIndexIdstr)) { strTem = twoEconIndexIdstr; } System.out.println("执行Ajax,且strTem=" + strTem); listSysEconIndexAjax = sysEconIndexManager.findForSubEconIndex(strTem);// 查找一级就是空了 return SUCCESS; }
原文链接:https://www.f2er.com/ajax/164848.html