What are Java Servlets?

翻译 2007年09月27日 16:39:00
   The Java Servlet API is an open standard,created by sun,for creating web applications using the Java programming language. A servlet is an object responsible for receiving a request from a client web browser and returning a response-an HTML page to be displayed in the browser.The Servlet API defines an interface and base class for servlets,as well as interfaces for several other supporting objects,such as the HttpServletRequest (which represents a request and allows the servlet to access query parameters).Vendors,both open source and proprietary,provide the actual server code and implementations of the standard interfaces.
    Servlets are most often paired with JavaServer Pages in order to generate a reponse.JSPs are a standard templating technology for servlets.A JSP is a mix of ordinary,static HTML with additional,specialized tags and directives that provide dynamic output,such as including the current user's name or the contents of an online shopping cart.Under the hood,each JSP is converted into a Java servlet that is compiled and loaded into memory.More information about servlets and JSPs is available online and in print ,including Web Development with JavaServer Pages.
    A servlet operates within a servlet container.The servlet container serves as a bridge between HTTP and the Java servlet code that you, as the developer ,will write.The servlet container is responsible for instantiating and initializing your servlets as needed.Servlet container s may be standalone,,such as Apache Tomcat,or may be one part of an  overall application server,such as BEA  WebLogic,IBM WebSphere ,or the open source JBoss application server.
    The servlet container is responsible for selecting the correct servlet to invoke based on the URL of the request;a single web application will contain many servlets.The web application's deployment descriptor gives the name and Java class for each servlet and identifies which URLs are mapped to which servlets.For example,your application may have a registration page containing an HTML form enabling new nsers to reggister .That form will submit to the addCustomer URL,which is mapped to the addCustomer servlet ,which is instantiated as the AddCustomerServlet class.The deployment descriptor will include the following elements describing the addCustomer servlet's configuration:
    As can be seen from this example,each servlet represents a particular operation within the overall web application.The AddCustomerServlet class will include code that reads the query parameters submitted with form and uses those values to create some kind of Customer object that can be stored into a database.Additional logic must decide what form of response to display-normally a confirmation page,but possibly the originalpage containing the form if an error occurred when creating the customer.

Java for the Web with Servlets, JSP, and EJB: A Developer's Guide to J2EE Solutions

版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出版、作者信息和本声明。否则将追究法律责任。http://blog.csdn.net/topmvp - topmvpJava for ...
  • topmvp
  • topmvp
  • 2008年08月20日 21:42
  • 323

Tomcat's Java Servlet Examples Explained

Tomcat provides a number of excellent servlet examples in “\webapps\examples“. The servlet source fi...
  • gmemai
  • gmemai
  • 2015年08月31日 05:45
  • 341

MyEclispe启动Tomcat7时出现错误The servlets named [LoginServlet] and [com.liu.control.LoginServlet] are both

刚开始尝试写Servlet代码,第一天就碰到这个错误,在网上找了很多资料才找到解决办法,在此记录一下。 org.apache.catalina.LifecycleException: Failed ...
  • kaifaxiaoliu
  • kaifaxiaoliu
  • 2017年05月10日 19:03
  • 711

The servlets named [LoginCheckServlet] and [LoginCheckServlet] are both mapped to the url-pattern [/

(⊙o⊙)… 在MyEclipse里成功部署项目无报错,但Tomcat服务器打开后报错404。 根据Tomcat报错原因:The servlets named [LoginCheckServlet] ...
  • Allthebest_
  • Allthebest_
  • 2017年12月29日 19:39
  • 60

Java Servlets

有关Java Servlets      JavaTM servlets 是一个不受平台约束的Java小程序,它可以被用来通过多种方法扩充一个Web服务器的功能。你可以把Servlet理解成Serve...
  • cation
  • cation
  • 2009年06月11日 21:46
  • 413

The servlets named [UserExit] and [com.fxh.control.UserExit] are both mapped to the url-pattern [/Us

同时匹配到 相同的 url-pattern  ,原因自动生成的 Servlet 3.0 Annotations 去掉代码中的 “  /**  * Servlet implementation ...
  • c_c123
  • c_c123
  • 2015年03月30日 20:37
  • 1084

向新手推荐《Head First Servlets & JSP》J2EE入门

http://blog.csdn.net/abbuggy/article/details/6776269 换了工作,转战J2EE开发。好像同事们都很惊讶于我干了5年的JAVA开发竟然一丁点没碰过...
  • ABBuggy
  • ABBuggy
  • 2011年09月14日 23:09
  • 7547

J2EE的TOMCAT服务器报The servlets named [x] and [y] are both mapped to the url-pattern[z] which is not per

解决The servlets named [x] and [y] are both mapped to the url-pattern[z] which is not permited.方法...
  • yanluandai1985
  • yanluandai1985
  • 2017年05月24日 15:56
  • 598

Head First Servlets & JSP 学习心得(一)

HTTP,TCP,IP协议 TCP:负责确保从一个网络节点向另一个网路节点发送的文件能作为一个完整的文件到达目的地,尽管在传送的过程中这个文件可能会分解为小块传输。 IP:是一个底层协议,负责把数据块...
  • zhaiax672
  • zhaiax672
  • 2016年10月02日 15:02
  • 413

The servlets named [A] and [B] are both mapped to the url-pattern [/servlet/]which is not permitted

错误:Caused by: java.lang.IllegalArgumentException: *The servlets named [client] and [servlet.com.Clie...
  • chenmeng930601
  • chenmeng930601
  • 2017年04月08日 11:36
  • 696
您举报文章:What are Java Servlets?