Today, servlet is used, so Tomcat is used. ^ _ ^, but after a simple small example is written, the ghost error HTTP status 404 is suddenly reported after Tomcat is started. in fact, there are many causes for such errors as 404. Here I will only share some of my problems here.
First, I wrote a servlet with the following code:
<Body>
<Form name = "myform" Action = "Test2" method = "Post">
<H2 align = "center">
User Information
</H2>
Name:
<Input type = "text" name = "name">
<Br>
Age:
<Input type = "text" name = "Age">
<Br>
Gender:
<Input type = "text" name = "sex">
<Br>
<Input type = "Submit" value = "Submit">
<Input type = "reset" value = "clear">
</Form>
</Body>
</Html>
The Web. xml file is configured as follows:
<? XML version = "1.0" encoding = "UTF-8"?>
<Web-app version = "2.4" 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>
<Servlet>
<Servlet-Name> test </servlet-Name>
<Servlet-class> com. myservlet </servlet-class>
</Servlet>
<Servlet-mapping>
<Servlet-Name> test </servlet-Name>
<URL-pattern>/Test2 </url-pattern>
</Servlet-mapping>
</Web-app>
In fact, my problem mainly lies in <form name = "myform" Action = "Test2" method = "Post">, Because I added a/before Test2 of action /, so I reported that kind of ghost error. I remember that I used to add/When I used it. At that time, there was no such error, but this time it would not work. no matter how it works, this time it should be OK. also, I want to remind you that the formaction OF THE FORM seems to be added/when you use struts later /. if a similar error occurs, you can pay attention to it.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.