menulist.jsp

来自「Java的框架」· JSP 代码 · 共 113 行

JSP
113
字号
<%@ include file="/common/taglibs.jsp"%>


<html>
	<head>
		<title><fmt:message key="menuList.title"/></title>
		<content tag="heading">
			<fmt:message key="menuList.heading"/>
		</content>
	</head>
	
	<body>
		<c:set var="buttons">
			<button type="button" style="margin-right: 5px" onclick="location.href='<c:url value="/editMenu.action"/>?method=Add&parentId=-1'">
  			<fmt:message key="button.add"/>
 			</button>
    
 			<button type="button" onclick="location.href='<c:url value="/mainPage.action" />'">
  			<fmt:message key="button.cancel"/>
 			</button>
		</c:set>

		<c:out value="${buttons}" escapeXml="false" />

		<table cellpadding="0" class="list menuList" cellspacing="0" id="menus">
			<thead>
				<tr>
					<th width="30%">Name</th>
					<th width="60%">Title</th>
					<th width="10%">&nbsp;</th>
			</thead>
			
<c:choose>
	<c:when test="${not empty menuList}">
			<tbody>
				
		<c:forEach items="${menuList}" var="menu" varStatus="status">
			<c:if test="${status.count % 2 == 0}">
				<tr class="odd">
			</c:if>
			<c:if test="${status.count % 2 != 0}">
				<tr class="even">
			</c:if>	
					<td width="30%">
						<a href="<c:url value="editMenu.action"/>?menuId=<c:out value="${menu.id}"/>&method=Edit"><c:out value="${menu.name}"/></a>
					</td>
					<td width="60%"><c:out value="${menu.title}"/>
					</td>
					<td width="10%">
						<c:if test="${!status.first}">
							<a href="javascript:moveUp ('<c:out value="${menu.id}"/>')">
							<img src="<c:url value="/images/up.gif"/>" alt="Move Up" border="0" width="14" style="cursor:hand;"/></a>
						</c:if>
						<c:if test="${status.first}">
							<img src="<c:url value="/images/dot.gif"/>" width="14"/>
						</c:if>             	
						<c:if test="${!status.last}">
							<a href="javascript:moveDown ('<c:out value="${menu.id}"/>')">
							<img src="<c:url value="/images/down.gif"/>" alt="Move Down" border="0" width="14" style="cursor:hand;"/></a>
						</c:if>
						<c:if test="${status.count == 1}">
							<img src="<c:url value="/images/dot.gif"/>" width="14"/>
						</c:if>   
					</td>
				</tr>
			</c:forEach>						
			
			</tbody>
	</c:when>
	
	<c:otherwise>
		
			<tbody>
				<tr class="empty">
					<td colspan="3"><fmt:message key="menuList.nomenus"/>
					</td>
				</tr>
			</tbody>
	</c:otherwise>
</c:choose>
			
		</table>
		
		<form method="post" action="<c:url value="/editMenuOrder.action"/>" name="menuListForm" id="menuListForm" >
			<input type="hidden" name="menuId" value=""/>
			<input type="hidden" name="parentId" value="-1"/>
			<input type="hidden" name="direction" value=""/>
		</form>
		
		<c:out value="${buttons}" escapeXml="false" />
            
		<script type="text/javascript">
		<!--
		// Comments highlightTableRows for Jameleon test tools click Order
		//	highlightTableRows("menus");
			
		
			function moveUp (menuId) {
				document.menuListForm.direction.value = "up";
				document.menuListForm.menuId.value = menuId;
				document.menuListForm.submit ();	
			}
			
			function moveDown (menuId) {
				document.menuListForm.direction.value = "down";
				document.menuListForm.menuId.value = menuId;
				document.menuListForm.submit ();	
			}
		
		//-->
		</script>
	</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?