0
我正在使用Spring Web應用程序並將其託管在雲上。我正在顯示一個表單來嚮應用程序輸入一些值。當我使用提交按鈕提交表單時,頁面被定向到/Myapp/createform.htm。我期望的是將表單提交給我的web服務器ec2-url/Myapp/createform.htm。 Web網址丟失,表單提交嘗試按名稱Myapp/createform.htm查找網站。請讓我知道什麼可能是錯的。如果提供的信息足夠,也請告訴我。我對此非常陌生。此代碼也適用於本地主機。在Spring應用程序中提交表單時丟失了Web服務器URL
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title><spring:message code="title.create" /></title>
</head>
<body>
<jsp:include flush="true" page="header.jsp"></jsp:include>
<div align="left"><spring:message code="${message}" text="" /></div>
<!-- Album Creation Form -->
<form:form>
<form:errors path="*" />
<table id="createAlbum">
<tr>
<th>Album Name*</th>
<td><form:input path="name" /></td>
</tr>
<tr>
<th>Description</th>
<td><form:textarea path="description" /></td>
</tr>
<tr>
<th>Album Labels</th>
<td><c:forEach items="${labels}" var="label">
<form:checkbox path="labels" value="${label}" />${label} <br />
</c:forEach></td>
</tr>
<tr>
<th>Creation Date</th>
<td><form:input path="creationDate" /></td>
</tr>
</table>
<input type="submit" value="Create" />
</form:form>
</body>
</html>
非常感謝,請按照以下說明附加內容來獲取整個網址。 action =「http:// {pageContext.request.serverName}:$ {pageContext.request.serverPort} $ {pageContext.request.contextPath} /createform.htm」 –