menuform.jsp
来自「Java的框架」· JSP 代码 · 共 294 行
JSP
294 行
<%@ include file="/common/taglibs.jsp"%>
<spring:bind path="menu.*">
<c:if test="${not empty status.errorMessages}">
<div class="error">
<c:forEach var="error" items="${status.errorMessages}">
<img src="<c:url value="/images/iconWarning.gif"/>"
alt="<fmt:message key="icon.warning"/>" class="icon" />
<c:out value="${error}" escapeXml="false"/><br />
</c:forEach>
</div>
</c:if>
</spring:bind>
<form method="post" action="<c:url value="/editMenu.action"/>" id="menuForm"
onsubmit="return onFormSubmit(this)">
<input type="hidden" name="method" value="<c:out value="${param.method}"/>" />
<input type="hidden" name="parentId" value="<c:out value="${menu.parentId}"/>" />
<c:if test="${not empty menu.id}">
<input type="hidden" name="menuId" value="<c:out value="${menu.id}"/>" />
</c:if>
<table class="detail">
<c:set var="pageButtons">
<tr>
<td></td>
<td class="buttonBar">
<c:if test="${param.method == 'Add'}">
<input type="submit" class="button" name="save" onclick="bCancel=false" value="<fmt:message key="button.add"/>" />
</c:if>
<c:if test="${param.method != 'Add'}">
<input type="submit" class="button" name="save" onclick="bCancel=false" value="<fmt:message key="button.save"/>" />
<input type="submit" class="button" name="delete" onclick="bCancel=true;return confirmDelete('menu and all its sub-menus')"
value="<fmt:message key="button.delete"/>" />
</c:if>
<input type="submit" class="button" name="cancel" onclick="bCancel=true" value="<fmt:message key="button.cancel"/>" />
</td>
</tr>
</c:set>
<tr>
<th>
<mcaps:label key="menu.name"/>
</th>
<td>
<spring:bind path="menu.name">
<input type="text" name="name" id="name" value="<c:out value="${status.value}"/>" maxlength="30"/>
<span class="fieldError"><c:out value="${status.errorMessage}"/></span>
</spring:bind>
</td>
</tr>
<tr>
<th>
<mcaps:label key="menu.title"/>
</th>
<td>
<spring:bind path="menu.title">
<input type="text" name="title" id="title" value="<c:out value="${status.value}"/>" maxlength="100"/>
<span class="fieldError"><c:out value="${status.errorMessage}"/></span>
</spring:bind>
</td>
</tr>
<tr>
<th>
<mcaps:label key="menu.page"/>
</th>
<td>
<spring:bind path="menu.page">
<input type="text" name="page" id="page" value="<c:out value="${status.value}"/>" maxlength="255" />
<span class="fieldError"><c:out value="${status.errorMessage}"/></span>
</spring:bind>
</td>
</tr>
<tr>
<th>
<mcaps:label key="menu.description"/>
</th>
<td>
<spring:bind path="menu.description">
<textarea name="description" id="description" rows="5" cols="50"><c:out value="${status.value}"/></textarea>
<span class="fieldError"><c:out value="${status.errorMessage}"/></span>
</spring:bind>
</td>
</tr>
<tr>
<th>
<mcaps:label key="menu.target"/>
</th>
<td>
<spring:bind path="menu.target">
<select name="target" id="target">
<option value="_self" <c:if test="${status.value == '_self'}">selected</c:if>>Same Window</option>
<option value="_blank" <c:if test="${status.value == '_blank'}">selected</c:if>>New Window</option>
</select>
<span class="fieldError"><c:out value="${status.errorMessage}"/></span>
</spring:bind>
</td>
</tr>
<tr>
<td>
</td>
<td>
<fieldset class="pickList">
<legend>
<fmt:message key="menuProfile.assignRoles"/>
</legend>
<table class="pickList">
<tr>
<th class="pickLabel">
<mcaps:label key="menu.availableRoles" colon="false" styleClass="required"/>
</th>
<td>
</td>
<th class="pickLabel">
<mcaps:label key="menu.roles" colon="false" styleClass="required"/>
</th>
</tr>
<mcaps:roleList key="availableRoles" scope="request" />
<mcaps:removeList from="${availableRoles}" with="${menu.roleList}" key="leftList" scope="request" />
<c:set var="rightList" value="${menu.roleList}" scope="request"/>
<c:import url="/WEB-INF/pages/pickList.jsp">
<c:param name="listCount" value="1"/>
<c:param name="leftId" value="availableRoles"/>
<c:param name="rightId" value="menuRoles"/>
</c:import>
</table>
</fieldset>
</td>
</tr>
<%-- Print out buttons - defined at top of form --%>
<%-- This is so you can put them at the top and the bottom if you like --%>
<c:out value="${pageButtons}" escapeXml="false" />
</table>
</form>
<script type="text/javascript">
<!--
highlightFormElements();
<%-- if we're doing an add, change the focus --%>
<c:set var="focus" value="name"/>
var focusControl = document.forms["menuForm"].elements["<c:out value="${focus}"/>"];
<c:if test="${empty param.order}">
if (focusControl.type != "hidden" && !focusControl.disabled) {
focusControl.focus();
}
</c:if>
<!-- This is here so we can exclude the selectAll call when roles is hidden -->
function onFormSubmit(theForm) {
selectAll('menuRoles');
return validateMenu(theForm);
}
// -->
</script>
<v:javascript formName="menu" staticJavascript="false"/>
<script type="text/javascript" src="<c:url value="/scripts/validator.jsp"/>"></script>
<c:if test="${not empty menu.id}">
<div class="separator"></div>
<h3>Sub Menu List</h3>
<c:set var="subListButtons">
<button type="button" style="margin-right: 5px" onclick="location.href='<c:url value="/editMenu.action"/>?method=Add&parentId=<c:out value="${menu.id}"/>'">
<fmt:message key="button.add"/>
</button>
</c:set>
<c:out value="${subListButtons}" 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%"> </th>
</thead>
<c:choose>
<c:when test="${not empty menu.menuItems}">
<tbody>
<c:forEach items="${menu.menuItems}" 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>
<script type="text/javascript">
<!--
highlightTableRows("menus");
//-->
</script>
<c:out value="${subListButtons}" escapeXml="false" />
<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="<c:out value="${menu.id}"/>"/>
<input type="hidden" name="direction" value=""/>
</form>
<script type="text/javascript">
<!--
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>
<a id="bP"></a>
</c:if>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?