英语编程文章阅读(2)

J2EE basics review(J2EE基础回顾)

1、Servlet summary(servlet总结)

难词:corresponding 符合的
processing处理
难句:
The servlet can set initialization parameters for internal use by the servlet.servlet可以设置初始化参数,供servlet内部使用。
A Servlet class will be only one instance, it called when initialization init()method, called when the destruction destroy()method .一个servlet只能被初始化一次,在初始化时调用init()方法,销毁时调用destroy()方法。
a servlet can set multiple URL access . Servlets are not thread-safe , so use class variables with caution.一个servlet可以设置多个url访问,不是线程安全的,所以谨慎使用类变量。
#### 2、Explain the difference between Servlet and CGI?
CGI:

disadvantage缺点
explain解释
overhead开销
the need to repeatedly(反复的) write the code and coding(编码) to deal with network protocols(协议), these tasks are very time-consuming.
Servlet:
advantages优势
if multiple requests need to do the same processing(进程), only one class needs to be loaded at this time.
All dynamically loaded classes can share network protocols and request decoding,所有动态加载的类可以共享网络协议和请求解码。
Servlet can directly(直接) interact(交互) with the Web server,

3、What are the methods in the Servlet interface and the servlet life cycle。servlet接口中有哪些方法及servlet的生命周期

the server will destroy the servlet instance when the server is shut down or the project is unloaded, 当服务器卸载或关闭时,服务器会销毁这个servlet。(不要老是顺序翻译嘛)
and the service method client will execute each time it requests the servlet 。service方法在客户端每次请求服务器都会执行。
so you can put the code (主要难点)that initializes the resource into the init method and the code that destroys the resource into the destroy method。你可以将初始化资源的代码放进init方法中,销毁资源的代码放入destroy 方法中。

4、Difference between get and post requests

两者并无本质区别。
essential本质的
obtain获取
The method attribute in the Form tag is called doGet () when it (指method attribute in the Form tag) is get, and doPost () when it is post.表单标签的method属性为get时调用doGet…

5、The difference between Forward and Redirect

知识盲区:Redirection (Redirect) is implemented using the status code returned by the server.
Server by HttpServletResponsethe setStatus(int status)method of setting the status code. If the server returns 301 or 302, the browser will re-request the resource at the new URL.服务器通过setStatus方法设置状态码,返回301时客户端会到新URL重新请求资源。
Forward地址栏不改变,Redirect地址栏改变。
Forward后两页面可共享request中的值,Redirect不会。
Redirect是两次请求效率低一些。
redirect: Generally used when the user logs out and returns to the main page and jumps to other websites.redirect常用于用户退出登录返回主页跳转到其他网站时。

Response.setHeader("Refresh","5;URL=http://localhost:8080/servlet/example.htm");
// Set the Header property in the Servlet through the HttpServletResponse object to implement automatic refresh. 通过HttpServletResponse 对象的Header属性设置自动刷新。
6、servlet的线程安全问题

使用synchronized(name)关键字会导致线程等待问题。
But if the attributes are only read concurrently without writing, there is no problem of data out of sync.把属性设置为只读 Therefore, the read-only attribute in the servlet is best defined as final.把只读属性设置为final

7、What is the relationship between JSP and Servlet

processed运行处理
separated分离的
presentation展示
In the case of 谈到。。。
combinded联合
servlet是一个运行在服务器端JVM上的程序,rely on the server to provide display content to the browser.依赖服务器的支持向浏览器提供显示内容。
JSP will be processed by the server into a Java program similar to Servlet, which can simplify the generation of page content. jsp会被服务器运行为一个类似于servlet的java程序,会简化页面内容的生成。
that the application logic of Servlet is in the Java file (servlet的应用逻辑是在java文件中) and is completely separated from the HTML in the presentation layer.从表示层的HTMl中分离出来。

8、How JSP works

detect检测
compiled编辑,编译
HttpServlet is compiled by the source code into a class file and then deployed to the server. Httpservlet是将源代码编译为class文件后部署到服务器上(先编译后部署,jsp是先部署后编译)。
This class is temporarily stored in the server working directory by the server.类被暂存到服务器的工作目录中。
知识盲区: JSP will only be compiled the first time the client requests it, it will feel slower the first time it is requested, and it will feel much faster afterwards.

9、What are the built-in objects and functions of JSPjsp内置对象的功能

encapsulates 封装
9大内置对象如下:

  • request: encapsulates the client’s request, which contains parameters from a GET or POST request;
  • response: encapsulates the server’s response to the client;
  • pageContext: This object can get other objects;
  • session: an object that encapsulates a user’s session;
  • application: an object that encapsulates the server’s operating environment;
  • out: the output stream object of the output server response;
  • config: configuration object of the web application;
  • page: the JSP page itself (equivalent to this in a Java program);
  • exception: An object that encapsulates a page that throws an exception.
10、What is the difference between request.getAttribute () and request.getParameter ()

acquisition获取
getParameter():Get the parameter value passed by POST / GET;
getAttribute():Get the data value in the object container;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值