最后,我们自己写一个自己的Servlet来看看里面具体的对象吧。
package linkin; import java.io.IOException; import javax.servlet.Servlet; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; public class LinkinServlet implements Servlet { @Override public void destroy() { } @Override public ServletConfig getServletConfig() { return null; } @Override public String getServletInfo() { return null; } @Override public void init(ServletConfig arg0) throws ServletException { System.out.println(arg0); } @Override public void service(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException { System.out.println(arg0); System.out.println(arg1); } }
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <servlet> <servlet-name>LinkinServlet</servlet-name> <servlet-class>linkin.LinkinServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>LinkinServlet</servlet-name> <url-pattern>/LinkinServlet</url-pattern> </servlet-mapping> </web-app>
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/u011794238/article/details/46786341