mapdetailform.jsp
来自「Java的框架」· JSP 代码 · 共 216 行
JSP
216 行
<%@ include file="/common/taglibs.jsp"%>
<c:if test="${param.method == 'add'}">
<c:set var="title"><fmt:message key="addMapDetail.title"/></c:set>
<c:set var="heading"><fmt:message key="addMapDetail.heading"/></c:set>
<c:set var="message"><fmt:message key="addMapDetail.message"/></c:set>
</c:if>
<c:if test="${param.method == 'edit'}">
<c:set var="title"><fmt:message key="editMapDetail.title"/></c:set>
<c:set var="heading"><fmt:message key="editMapDetail.heading"/></c:set>
<c:set var="message"><fmt:message key="editMapDetail.message"/></c:set>
</c:if>
<html>
<head>
<title><c:out value="${title}"/></title>
<content tag="heading">
<c:out value="${heading}"/>
</content>
<script type="text/javascript" src="<c:url value='/scripts/selectbox.js'/>"></script>
</head>
<script type="text/javascript" language="JavaScript"><!--
function checkSubmit(){
if (bCancel){
return true;
}
if (onFormSubmit(document.forms.mapDetailForm)){
return (checkExt(document.forms.mapDetailForm.mapContextFile) &&
checkExt(document.forms.mapDetailForm.mapLocatorContextFile));
}else {
return false;
}
}
function checkExt(fileCtl) {
var name = fileCtl.name;
var textCtl;
if (name == "mapContextFile"){
textCtl = document.forms.mapDetailForm.contextFile;
}else{
textCtl = document.forms.mapDetailForm.locatorContextFile;
}
var ext = fileCtl.value;
<c:if test="${param.method == 'edit'}">
if (ext.length == 0) return true;
</c:if>
<c:if test="${param.method == 'add'}">
if (name == "mapLocatorContextFile"){
if (ext.length == 0) return true;
}else if (name == "mapContextFile"){
if (ext.length == 0){
fileCtl.focus();
alert('Map context file is required.');
return false;
}
}
</c:if>
ext = ext.substring(ext.length-4,ext.length);
ext = ext.toLowerCase();
if(ext != '.xml' && ext != '.jsp') {
fileCtl.focus();
alert('Please select a valid config file with .xml or .jsp extension');
return false;
}
else{
textCtl.value = fileCtl.value;
return true; //onFormSubmit(document.forms.mapDetailForm);
}
}
//--></script>
<body>
<c:choose>
<c:when test="${param.method == 'edit' && !empty mapDetail && empty mapDetail.name}">
<div class="error">
<img src="<c:url value="/images/iconWarning.gif"/>"
alt="<fmt:message key="icon.warning"/>" class="icon" />
<fmt:message key="errors.map.edit.notfound">
<fmt:param value="${param.mapName}"/>
</fmt:message><br>
</div>
<a href="<c:url value="/mapDetails.action"/>">« Back</a>
</c:when>
<c:otherwise>
<span id="message"><c:out value="${message}"/></span>
<div class="separator"></div>
<spring:bind path="mapDetail.*">
<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>
<c:set var="pageButtons">
<tr>
<td width="20%" valign="top">
</td>
<td class="buttonBar" width="80%" valign="top">
<c:if test="${param.method == 'add'}">
<input type="submit" class="button" name="save" onclick="bCancel=false" value="<fmt:message key="button.add"/>" />
<input type="submit" class="button" name="cancel" onclick="bCancel=true" value="<fmt:message key="button.cancel"/>" />
</c:if>
<c:if test="${param.method == 'edit'}">
<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('Map Detail')" value="<fmt:message key="button.delete"/>" />
<input type="submit" class="button" name="cancel" onclick="bCancel=true" value="<fmt:message key="button.cancel"/>" />
</c:if>
</td>
</tr>
</c:set>
<form method="post" action="<c:url value="/mapDetailForm.action"/>" id="mapDetailForm" name="mapDetailForm" enctype="multipart/form-data" onsubmit="return checkSubmit()">
<input type="hidden" name="method" value="<c:out value="${param.method}"/>" />
<input type="hidden" name="from" value="<c:out value="${param.from}"/>" />
<input type="hidden" name="mapName" value="<c:out value="${param.mapName}"/>" />
<spring:bind path="mapDetail.version">
<input type="hidden" id="<c:out value="${status.expression}"/>"
name="<c:out value="${status.expression}"/>"
value="<c:out value="${status.value}"/>">
</spring:bind>
<table class="detail">
<tr>
<th width="20%">
<mcaps:label key="mapDetail.name"/>
</th>
<td width="80%">
<spring:bind path="mapDetail.name">
<c:if test="${param.method == 'add'}">
<input type="text" id="<c:out value="${status.expression}"/>"
name="<c:out value="${status.expression}"/>"
value="<c:out value="${status.value}"/>" size="40">
</c:if>
<c:if test="${param.method == 'edit'}">
<input type="hidden" id="<c:out value="${status.expression}"/>"
name="<c:out value="${status.expression}"/>"
value="<c:out value="${status.value}"/>" size="40">
<c:out value="${status.value}"/>
</c:if>
</spring:bind>
</td>
</tr>
<tr>
<th width="20%">
<mcaps:label key="mapDetail.contextFile"/>
</th>
<td width="80%">
<spring:bind path="mapDetail.contextFile">
<input type="hidden" id="<c:out value="${status.expression}"/>"
name="<c:out value="${status.expression}"/>"
value="<c:out value="${status.value}"/>">
<input type="file" name="mapContextFile" size="85" onchange="javascript:checkExt(this)">
</spring:bind>
</td>
</tr>
<tr>
<th width="20%">
<mcaps:label key="mapDetail.locatorContextFile"/>
</th>
<td width="80%">
<spring:bind path="mapDetail.locatorContextFile">
<input type="hidden" id="<c:out value="${status.expression}"/>"
name="<c:out value="${status.expression}"/>"
value="<c:out value="${status.value}"/>">
<input type="file" name="mapLocatorContextFile" size="85" onchange="javascript:checkExt(this)">
</spring:bind>
</td>
</tr>
<tr>
<th width="20%">
<mcaps:label key="mapDetail.description"/>
</th>
<td width="80%">
<spring:bind path="mapDetail.description">
<textarea cols="80" rows="2" id="<c:out value="${status.expression}"/>"
name="<c:out value="${status.expression}"/>"><c:out value="${status.value}"/></textarea>
</spring:bind>
</td>
</tr>
</table>
<div class="separator"></div>
<table width="100%">
<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["mapDetailForm"].elements["<c:out value="${focus}"/>"];
function onFormSubmit(theForm) {
return validateMapDetail(theForm);
}
</script>
<v:javascript formName="mapDetail" staticJavascript="false"/>
<script type="text/javascript"
src="<c:url value="/scripts/validator.jsp"/>">
</script>
</c:otherwise>
</c:choose>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?