在Web服务器中处理JSP的多个请求 [英] Processing of multiple request(s) of jsp in webserver

查看:110
本文介绍了在Web服务器中处理JSP的多个请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当有多个请求发送到服务器时,jsp的处理过程如何发生?是为所有请求创建单个对象还是创建对象并以线程方式处理每个请求?

How does process of jsp happens when there about more than one request is coming to the server? whether it creates individual objects for all the requests or creates an object and process the every request as thread?

如果有人用图像/图表解释,那么对每个人都会有帮助.

if anyone explains with image/diagram then it will be helpful for everyone.

感谢您提前解释这个概念.

Thanks for explaining the concept in advance.

推荐答案

JSP页面或以以下方式处理对JSP的请求:

JSP page Or Request to JSP processed in the following way :

  1. 用户通过以.jsp文件结尾的URL请求JSP页面 姓名.
  2. 在URL中注意到.jsp文件扩展名后, Web服务器的Servlet Container调用JSP容器.
  3. 如果这是第一次请求,则JSP容器会找到JSP页面,并将其转换为servlet类.翻译包括在.java文件中生成servlet代码,然后编译.java.文件以生成servlet .class文件.
  4. 将JSP页面转换为servlet会自动将标准servlet编程开销合并到生成的servlet代码中,例如实现javax.servlet.jsp.HttpJspPage接口并为其服务方法生成代码.
  5. JSP容器触发页面实现类的实例化和执行.
  1. The user requests the JSP page through a URL ending with a .jsp file name.
  2. Upon noting the .jsp file name extension in the URL, the Servlet Container of the Web server invokes the JSP container.
  3. The JSP container locates the JSP page and translates it to servlet class if this is the first time it has been requested. Translation includes producing servlet code in a .java file and then compiling the .java file to produce a servlet .class file.
  4. Translating a JSP page into a servlet automatically incorporates standard servlet programming overhead into the generated servlet code, such as implementing the javax.servlet.jsp.HttpJspPage interface and generating code for its service method.
  5. The JSP container triggers instantiation and execution of the page implementation class.

余下的工作与Servlet相同.然后,该servlet(JSP页面实例)将处理HTTP请求,生成HTTP响应,并将该响应传递回客户端.
Servlet容器通常通过为每个请求创建一个新的Java线程来管理并发请求.

Than rest is working same as Servlet. The servlet (JSP page instance) will then process the HTTP request, generate an HTTP response, and pass the response back to the client.
Servlet Containers usually manages concurrent requests by creating a new Java thread for each request.

上面提到的所有步骤都可以在下图中显示:

All the above mentioned steps can be shown below in the following diagram:

我希望这将有助于您了解所要查找的内容.

I hope this will help you to understand what you are looking for.

这篇关于在Web服务器中处理JSP的多个请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆