roleform.jsp

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

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


<spring:bind path="role.*">
    <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="/editRole.action"/>" id="roleForm" onsubmit="return onFormSubmit(this)">
    
<spring:bind path="role.version">
	<input type="hidden" name="version" value="<c:out value="${status.value}"/>"/> 
</spring:bind>

<input type="hidden" name="from" value="<c:out value="${param.from}"/>" />
<input type="hidden" name="method" value="<c:out value="${param.method}"/>" />

<table class="detail">
<c:set var="pageButtons">
	<tr>
  	<td></td>
 		<td class="buttonBar">
    
 		<c:if test="${param.from != 'list'}">
      <input type="submit" class="button" name="save" onclick="bCancel=false" value="<fmt:message key="button.save"/>" />
  	</c:if>
    
  	<c:if test="${param.from == 'list'}">
    	
  		<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('role')" value="<fmt:message key="button.delete"/>" />
      </c:if>       
 		</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="role.name"/>
   	</th>
 		<td>
    	<spring:bind path="role.name">
    	<c:choose>
      	<c:when test="${param.method == 'Add'}">
        	<input type="text" name="name" value="<c:out value="${status.value}"/>" id="name" maxlength="50"/>
         	<span class="fieldError"><c:out value="${status.errorMessage}" escapeXml="false" /></span>
       	</c:when>
        <c:otherwise>
        	<c:out value="${role.name}"/>
        	<input type="hidden" name="name" value="<c:out value="${status.value}"/>" id="name"/>
       	</c:otherwise>
     	</c:choose>
      </spring:bind>
   	</td>
	</tr>
  
	<tr>
  	<th>
   		<mcaps:label key="role.description"/>
   	</th>
    <td>
    	<spring:bind path="role.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>
  	<td></td>
    <td>
    	<fieldset class="pickList">
      	<legend>
        	<fmt:message key="roleProfile.assignUsers"/>
       	</legend>
	           
       	<table class="pickList">
	      	<tr>
	        	<th class="pickLabel">
	          	<mcaps:label key="role.availableUsers" colon="false" styleClass="required"/>
	         	</th>
	          <td>
	          </td>
	          <th class="pickLabel">
	          	<mcaps:label key="role.users" colon="false" styleClass="required"/>
	         	</th>
	      	</tr>
	                
	     		<mcaps:assignableUsers key="leftList" scope="request" />
	        
	     		<c:set var="rightList" value="${role.userList}" scope="request"/>
	        <c:import url="/WEB-INF/pages/pickList.jsp">
	        	<c:param name="listCount" value="1"/>
	          <c:param name="leftId" value="availableUsers"/>
	          <c:param name="rightId" value="roleUsers"/>
	       	</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:choose>
	<c:when test="${role.name == null}"><c:set var="focus" value="name"/></c:when>
	<c:otherwise>
		<c:set var="focus" value="description"/>
	</c:otherwise>
</c:choose>


var focusControl = document.forms["roleForm"].elements["<c:out value="${focus}"/>"];

if (focusControl.type != "hidden" && !focusControl.disabled) {
    focusControl.focus();
}


<!-- This is here so we can exclude the selectAll call when roles is hidden -->
function onFormSubmit(theForm) {
<c:if test="${param.from == 'list'}">
    selectAll('roleUsers');
</c:if>
    return validateRole(theForm);
}
// -->
</script>

<v:javascript formName="role" staticJavascript="false"/>
<script type="text/javascript"
      src="<c:url value="/scripts/validator.jsp"/>"></script>

⌨️ 快捷键说明

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