标签:lru usb pst ogr min nbu fzu v2v ati
在Eclipse中创建Servlet后,Eclipse不会自动在web.xml中生成该Servlet对应的mapping信息,而是在Servlet代码中加入注解@WebServlet。
@WebServlet 用于将一个类声明为 Servlet,该注解将会在部署时被容器处理,容器将根据具体的属性配置将相应的类部署为 Servlet。
//对应旧版本中servlet标签中的内容
@WebServlet(displayName = "This is ForwordServlet", // 描述 name = "ForwordServlet", // servlet名称 urlPatterns = { "/forwordServlet" }, // url loadOnStartup = 1, // 启动项 initParams = { @WebInitParam(name = "username", value = "张三") }// 初始化参数 ) public class ForwordServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse * response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.getWriter().append("Served at: ").append(request.getContextPath()); } }
标签:lru usb pst ogr min nbu fzu v2v ati
原文地址:http://www.cnblogs.com/CComma/p/7138015.html