<html>
<head>
<title>Currency Converter</title>
</head>
<body>
<h1>Currency Converter</h1>
<HR>
<form method=get action="http://localhost:8080/logan_jahnke_currency/app/Converter">
<P>Enter your amount of money is US Dollars below (do not include the dollar sign)
<P>For example: <tt>20</tt>
<P>Input amount in dollars: <INPUT NAME="dollars" TYPE=text size=50>
<select name="currency">
<option value="USD">United States Dollar</option>
<option value="ARS">Argentinean Peso</option>
<option value="AUD">Australian Dollar</option>
<option value="BRL">Brazilian Real</option>
<option value="GBP">British Pound</option>
<option value="CAD">Canadian Dollar</option>
<option value="CLP">Chilean Peso</option>
<option value="CNY">Chinese YuanRenminbi</option>
<option value="CZK">Czech Koruna</option>
<option value="DKK">Danish Krone</option>
</select>
<P><P><P><INPUT TYPE=submit> <INPUT TYPE=reset>
</form>
</body>
</html>
HTML文件^
XML文件V
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>converter</servlet-name>
<servlet-class>logan_jahnke_currency.Converter</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>converter</servlet-name>
<url-pattern>/converter</url-pattern>
</servlet-mapping>
</web-app>
目录:
app
converter.html
WEB-INF
classes
logan_jahnke_currency
Converter.class
lib
*.jar
web.xml
我的初始HTML在以下地址正常工作:http://localhost:8080/logan_jahnke_currency/app/converter.html
然而,当我按提交时,我得到&#34; Not Found&#34;。
有人看到了这个问题吗?我无法理解。
答案 0 :(得分:2)
根据您发布的servlet映射,
action="http://localhost:8080/logan_jahnke_currency/app/Converter"
假设您的应用程序根上下文为logan_jahnke_currency
,那么它应该是
action="http://localhost:8080/logan_jahnke_currency/converter"
因为你有
<url-pattern>/converter</url-pattern>
在你的地图中。