I get error prone, could you help?
servlet
public class FirstClass extends HttpServlet { private static final long serialVersionUID = 1L; public void doGet(HttpServletResponse response, HttpServletRequest request) throws IOException, ServletException { PrintWriter out = response.getWriter(); out.println("this is a sample"); out.flush(); } public void doPost(HttpServletResponse response, HttpServletRequest request) throws IOException, ServletException { PrintWriter out = response.getWriter(); out.println("this is a sample"); out.flush(); } }
web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" 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"> <display-name>hii</display-name> <servlet> <servlet-name>First</servlet-name> <servlet-class>test.FirstClass</servlet-class> </servlet> <servlet-mapping> <servlet-name>First</servlet-name> <url-pattern>/first.do</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> </web-app>
index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <a href="first.do">Click Me</a> </body> </html>
source share