简体   繁体   中英

Error 404 on trying to run a Dynamic Web Project

I have created a Dynamic Web Project named as DynamicPages. Whenever I am trying to run it on server, I am getting error 404 which says : The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

Following is my web.xml file :

 <?xml version="1.0" encoding="UTF-8"?>
 <element>
 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns="http://xmlns.jcp.org/xml/ns/javaee"      
 xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org
 /xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">

  <display-name>DynamicPages</display-name>
 <welcome-file-list>
<welcome-file>pageone.html</welcome-file>
<welcome-file>pagetwo.html</welcome-file>
<welcome-file>output.jsp</welcome-file>

 </welcome-file-list>
 <servlet>
 <description></description>
<display-name>PageoneServlet</display-name>
<servlet-name>PageoneServlet</servlet-name>
<servlet-class>com.as.samples.PageoneServlet</servlet-class>
 </servlet>
<servlet-mapping>
<servlet-name>PageoneServlet</servlet-name>
<url-pattern>/PageoneServlet</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>PagetwoServlet</display-name>
<servlet-name>PagetwoServlet</servlet-name>
<servlet-class>com.as.samples.PagetwoServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PagetwoServlet</servlet-name>
<url-pattern>/PagetwoServlet</url-pattern>
</servlet-mapping>

</web-app>

Following is the html file pageone.html :

 <!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
  </head>
  <body>
  <h2>Student Details</h2>
 <form method = "post" action="PageoneServlet">
  Name     : <input type = "text" name = "name" /></br>
  Address:    <input type = "text" name = "address" /></br>
  Phone:   <input type="text" name = "phn" /> </br>
  <input type = "Submit"  value = "submit" />
  </form>
  </body>
  </html>

Please help and advise.

尝试使用index.html作为欢迎文件(如果没有),然后在URL中也传递pageone.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM