- 浏览: 458788 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (272)
- java基础 (59)
- struts (8)
- spring (8)
- 数据库 (8)
- java 网络编程 (29)
- hibernate (3)
- JavaScript (10)
- 日志管理 (2)
- jsp (4)
- servlet (7)
- xml (4)
- ajax (2)
- web service (4)
- 算法与数据结构 (13)
- java 反射机制 (11)
- java 泛型 (3)
- java I/O (8)
- java 线程 (12)
- JavaEE (6)
- java解惑 (33)
- 工具 (5)
- MyEclipse编程实践 (1)
- OSGI (2)
- 设计模式 (9)
- 正则表达式 (0)
- EJB (3)
- Ubuntu linux (6)
- Android (1)
- web前端 (2)
- 找工作 (1)
- SCA (1)
- maven (1)
- 缓存 (1)
- json (1)
- javamail (1)
- 工作笔记 (2)
最新评论
-
霜花似雪:
博主可以分享一下源码吗?
使用maven构建web项目实例 -
王庆波-行:
很好的demo!
memcache使用实例 -
surpassno:
大写的牛逼
java可视化显示内存使用情况 -
zhulin0504:
怎么访问NetEcho.html页面呀???
applet与servlet的网络通信 -
springdata:
java多线程实例demo源代码下载:http://www.z ...
java多线程例子
Q: Explain the life cycle methods of a Servlet.
A: The javax.servlet.Servlet interface defines the three methods known as life-cycle method.
public void init(ServletConfig config) throws ServletException
public void service( ServletRequest req, ServletResponse res) throws ServletException, IOException
public void destroy()
First the servlet is constructed, then initialized wih the init() method.
Any request from client are handled initially by the service() method before delegating to the doXxx() methods in the case of HttpServlet.
The servlet is removed from service, destroyed with the destroy() methid, then garbaged collected and finalized.
TOP
Q: What is the difference between the getRequestDispatcher(String path) method of javax.servlet.ServletRequest interface and javax.servlet.ServletContext interface?
A: The getRequestDispatcher(String path) method of javax.servlet.ServletRequest interface accepts parameter the path to the resource to be included or forwarded to, which can be relative to the request of the calling servlet. If the path begins with a "/" it is interpreted as relative to the current context root.
The getRequestDispatcher(String path) method of javax.servlet.ServletContext interface cannot accepts relative paths. All path must sart with a "/" and are interpreted as relative to curent context root.
TOP
Q: Explain the directory structure of a web application.
A: The directory structure of a web application consists of two parts.
A private directory called WEB-INF
A public resource directory which contains public resource folder.
WEB-INF folder consists of
1. web.xml
2. classes directory
3. lib directory
TOP
Q: What are the common mechanisms used for session tracking?
A: Cookies
SSL sessions
URL- rewriting
TOP
Q: Explain ServletContext.
A: ServletContext interface is a window for a servlet to view it's environment. A servlet can use this interface to get information such as initialization parameters for the web applicationor servlet container's version. Every web application has one and only one ServletContext and is accessible to all active resource of that application.
TOP
Q: What is preinitialization of a servlet?
A: A container doesnot initialize the servlets ass soon as it starts up, it initializes a servlet when it receives a request for that servlet first time. This is called lazy loading. The servlet specification defines the <load-on-startup> element, which can be specified in the deployment descriptor to make the servlet container load and initialize the servlet as soon as it starts up. The process of loading a servlet before any request comes in is called preloading or preinitializing a servlet.
[ Received from Amit Bhoir ] TOP
Q: What is the difference between Difference between doGet() and doPost()?
A: A doGet() method is limited with 2k of data to be sent, and doPost() method doesn't have this limitation. A request string for doGet() looks like the following:
http://www.allapplabs.com/svt1?p1=v1&p2=v2&...&pN=vN
doPost() method call doesn't need a long text tail after a servlet name in a request. All parameters are stored in a request itself, not in a request string, and it's impossible to guess the data transmitted to a servlet only looking at a request string.
[ Received from Amit Bhoir ] TOP
Q: What is the difference between HttpServlet and GenericServlet?
A: A GenericServlet has a service() method aimed to handle requests. HttpServlet extends GenericServlet and adds support for doGet(), doPost(), doHead() methods (HTTP 1.0) plus doPut(), doOptions(), doDelete(), doTrace() methods (HTTP 1.1).
Both these classes are abstract.
[ Received from Amit Bhoir ] TOP
Q: What is the difference between ServletContext and ServletConfig?
A: ServletContext: Defines a set of methods that a servlet uses to communicate with its servlet container, for example, to get the MIME type of a file, dispatch requests, or write to a log file.The ServletContext object is contained within the ServletConfig object, which the Web server provides the servlet when the servlet is initialized
ServletConfig: The object created after a servlet is instantiated and its default constructor is read. It is created to pass initialization information to the servlet.
[ Received from Sivagopal Balivada ]
A: The javax.servlet.Servlet interface defines the three methods known as life-cycle method.
public void init(ServletConfig config) throws ServletException
public void service( ServletRequest req, ServletResponse res) throws ServletException, IOException
public void destroy()
First the servlet is constructed, then initialized wih the init() method.
Any request from client are handled initially by the service() method before delegating to the doXxx() methods in the case of HttpServlet.
The servlet is removed from service, destroyed with the destroy() methid, then garbaged collected and finalized.
TOP
Q: What is the difference between the getRequestDispatcher(String path) method of javax.servlet.ServletRequest interface and javax.servlet.ServletContext interface?
A: The getRequestDispatcher(String path) method of javax.servlet.ServletRequest interface accepts parameter the path to the resource to be included or forwarded to, which can be relative to the request of the calling servlet. If the path begins with a "/" it is interpreted as relative to the current context root.
The getRequestDispatcher(String path) method of javax.servlet.ServletContext interface cannot accepts relative paths. All path must sart with a "/" and are interpreted as relative to curent context root.
TOP
Q: Explain the directory structure of a web application.
A: The directory structure of a web application consists of two parts.
A private directory called WEB-INF
A public resource directory which contains public resource folder.
WEB-INF folder consists of
1. web.xml
2. classes directory
3. lib directory
TOP
Q: What are the common mechanisms used for session tracking?
A: Cookies
SSL sessions
URL- rewriting
TOP
Q: Explain ServletContext.
A: ServletContext interface is a window for a servlet to view it's environment. A servlet can use this interface to get information such as initialization parameters for the web applicationor servlet container's version. Every web application has one and only one ServletContext and is accessible to all active resource of that application.
TOP
Q: What is preinitialization of a servlet?
A: A container doesnot initialize the servlets ass soon as it starts up, it initializes a servlet when it receives a request for that servlet first time. This is called lazy loading. The servlet specification defines the <load-on-startup> element, which can be specified in the deployment descriptor to make the servlet container load and initialize the servlet as soon as it starts up. The process of loading a servlet before any request comes in is called preloading or preinitializing a servlet.
[ Received from Amit Bhoir ] TOP
Q: What is the difference between Difference between doGet() and doPost()?
A: A doGet() method is limited with 2k of data to be sent, and doPost() method doesn't have this limitation. A request string for doGet() looks like the following:
http://www.allapplabs.com/svt1?p1=v1&p2=v2&...&pN=vN
doPost() method call doesn't need a long text tail after a servlet name in a request. All parameters are stored in a request itself, not in a request string, and it's impossible to guess the data transmitted to a servlet only looking at a request string.
[ Received from Amit Bhoir ] TOP
Q: What is the difference between HttpServlet and GenericServlet?
A: A GenericServlet has a service() method aimed to handle requests. HttpServlet extends GenericServlet and adds support for doGet(), doPost(), doHead() methods (HTTP 1.0) plus doPut(), doOptions(), doDelete(), doTrace() methods (HTTP 1.1).
Both these classes are abstract.
[ Received from Amit Bhoir ] TOP
Q: What is the difference between ServletContext and ServletConfig?
A: ServletContext: Defines a set of methods that a servlet uses to communicate with its servlet container, for example, to get the MIME type of a file, dispatch requests, or write to a log file.The ServletContext object is contained within the ServletConfig object, which the Web server provides the servlet when the servlet is initialized
ServletConfig: The object created after a servlet is instantiated and its default constructor is read. It is created to pass initialization information to the servlet.
[ Received from Sivagopal Balivada ]
发表评论
-
数据库及struts面试题
2011-06-22 11:07 1027数据库部分 Q: What is SQL? ... -
EJB面试题
2011-06-22 10:54 1096Q: What are the different kinds ... -
java中JSP的面试题
2011-06-22 10:22 1506Q: What is a output comment? (可 ... -
java中的集合面试题
2011-06-22 10:12 689Q: What is the Collections API? ... -
彻底搞清楚java的内部类
2011-06-15 10:47 1454内部类允许在一个类中 ... -
细说java(java中的浮点数十六进制表示)
2011-06-12 16:48 3510java中浮点数不能用八进制表示,但可以用十六进制表示,只能用 ... -
SCJP试题
2011-06-09 16:14 1143package scjp; public class T ... -
java面试题解惑 之 继承、多态、重载、重写
2011-06-03 09:36 1271继承、多态、重载、重写 继承 java中有三种类:类,抽象类, ... -
java面试题解惑 之 多线程
2011-06-02 17:24 9511,多线程 线程或者说 ... -
java面试题解惑 之变量初始顺序,变量覆盖,字符串池,final,finally区别
2011-06-02 16:26 7631,变量初始化顺序 package com.qdu.sun; ... -
java解惑(Map的使用,静态导入方法,线程中断interrupted与线程死锁)
2011-05-17 12:38 1363Map的使用 package other; import ... -
java 继承的一个问题(想不明白)
2011-04-13 17:03 884java中的继承问题,以为是学会了java,结果最简单的一个j ... -
java解惑(谜题76。。)
2011-03-09 11:22 1179谜题76:乒乓public class PingPong { ... -
java解惑(谜题60,65)
2011-03-08 15:52 887一行以毙之 1,编写一个 ... -
java解惑(谜题66。。。)
2011-02-28 20:54 913谜题66:一件私事 class Base{ public ... -
java解惑(谜题61。。。)
2011-02-28 20:17 886谜题61:日期游戏 import java.util.Cal ... -
java解惑(谜题56到。。库之谜)
2011-02-28 19:41 829谜题56:大问题 import jav ... -
java解惑(谜题49。。)
2011-02-27 10:52 925谜题49:比生命更大 import java.util.Cal ... -
java解惑(谜题41到谜题)
2011-02-27 10:18 885谜题41:域和流 下面的 ... -
谜题36-谜题
2011-02-25 10:55 860谜题36:优柔寡断 public ...
相关推荐
企业的经典java面试题,Java面试题,jsp&servlet面试题
servlet面试题
Servlet面试题 – Java Web开发面试题
│ Java面试题04.java中int占几个字节.mp4 │ Java面试题05.java面向对象的特征.mp4 │ Java面试题06.装箱和拆箱.mp4 │ Java面试题07.==和equals的区别.mp4 │ Java面试题08.String.mp4 │ Java面试题09.讲一下java...
java最新面试题 java struts servlet spring ejb
Java重点面试题 – 针对java面试过程中经常遇到的一些试题进行总结.docx JAVA面试基础知识点总结.docx Java面试笔记.docx 写出正则表达式,从一个字符串中提取链接地址.docx 出现几率最高和覆盖范围最广的一套经典...
文件中包含了本人最近在网上总结的面试题,有java面试题,jq面试题,jsp、servlet、ajax面试题,mysql面试题,oracle面试题,redis教案,也有最近时间总结的公司面试题,涉及的层面虽然不是很多,但是应对面试 应该...
Java面试题19.Servlet中forward和redirect的区别 Java面试题20.jsp和Servlet的相同点和不同点 Java面试题21.内置对象和四大作用域和页面传值 Java面试题22.Session和Cookie的区别和使用场景 Java面试题23.mvc模式和...
Java及数据库面试题 包含SSH,数据库和Java基础
面试题(很多企业都常常从这些面试题库中选题作为笔试题): Java就业面试题大全.pdf Java最全的面试题.pdf java面试100题目.pdf SQL面试题大全.pdf 开发面试75条.pdf java 面试题 数据库方面.pdf 如何写出高性能的...
答:<%@page isThreadSafe=false%> 面试中会遇到! 6、页面间对象传递的方法 答:request,session,application,cookie等 7、JSP和Servlet有哪些相同点和不同点,他们之间的联系是什么? 答:JSP是Servlet...
1.8Tomcat、Servlet面试题 1.9多线程面试题 1.10MyBatis面试题 1.11Spring MVC面试题 1.12Spring Boot面试题 1.13Spring Cloud面试题 2、中间件面试题 3、数据库&SQL面试题 4、前端面试题 4.1...
常考面试题 1.讲下servlet的执行流程。 Servlet的执行流程也就是servlet的生命周期,当服务器启动的时候生命周期开始,然后通过init()《启动顺序根据web.xml里的startup-on-load来确定加载顺序》 方法初始化...
Java面试题19.Servlet中forward和redirect的区别 Java面试题20.jsp和Servlet的相同点和不同点 Java面试题21.内置对象和四大作用域和页面传值 Java面试题22.Session和Cookie的区别和使用场景 Java面试题23.mvc模式和...
资源总结了近年来Java web开发的全部面试题,其中大部分也是开发过程中常常使用的资源,作为参考资料,算是全集,包含了Java基础,jsp,servlet,ssh框架,ajax,jquery等等方面知识。
面试题包括以下十九部分:Java 基础、容器、多线程、反射、对象拷贝、Java Web 模块、异常、网络、设计模式、Spring/Spring MVC、Spring Boot/Spring Cloud、Hibernate、Mybatis、RabbitMQ、Kafka、Zookeeper、MySql...
│ 上海税友软件 面试题.doc │ 公司培训文档-混淆的基本概念.doc │ 基本算法.doc │ 孙卫琴精通struts.基于MVC的.java.web设计与开发.pdf │ 学习Struts提供的和Form相关标签.txt │ 日企编码规范.doc │ 电信盈科...
收集总结了许多学长面试不同公司时面到的实际面试题。以及分享了回答问题的经验。 自己在去年10月份校招时,感觉有点用,特别是在给自己查漏补缺方面有一定的帮助。可以边看边结合里面提供的代码进行上机试验,已...
String 和StringBuffer的区别? 说出Servlet的生命周期,并说出Servlet和CGI的区别? EJB是基于哪些技术实现的?并说出SessionBean和EntityBean的区别,StatefulBean和StatelessBean的区别?...200道关于JAVA面试题。
海量的Java面试题 Struts面试题 Spring面试题 Hibernate面试题 EJB面试题 JSP面试题 Servlet面试题 大家可以参考一下