- 浏览: 467758 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (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 1060数据库部分 Q: What is SQL? ... -
EJB面试题
2011-06-22 10:54 1126Q: What are the different kinds ... -
java中JSP的面试题
2011-06-22 10:22 1544Q: What is a output comment? (可 ... -
java中的集合面试题
2011-06-22 10:12 721Q: What is the Collections API? ... -
彻底搞清楚java的内部类
2011-06-15 10:47 1507内部类允许在一个类中 ... -
细说java(java中的浮点数十六进制表示)
2011-06-12 16:48 3566java中浮点数不能用八进制表示,但可以用十六进制表示,只能用 ... -
SCJP试题
2011-06-09 16:14 1179package scjp; public class T ... -
java面试题解惑 之 继承、多态、重载、重写
2011-06-03 09:36 1301继承、多态、重载、重写 继承 java中有三种类:类,抽象类, ... -
java面试题解惑 之 多线程
2011-06-02 17:24 9921,多线程 线程或者说 ... -
java面试题解惑 之变量初始顺序,变量覆盖,字符串池,final,finally区别
2011-06-02 16:26 7991,变量初始化顺序 package com.qdu.sun; ... -
java解惑(Map的使用,静态导入方法,线程中断interrupted与线程死锁)
2011-05-17 12:38 1397Map的使用 package other; import ... -
java 继承的一个问题(想不明白)
2011-04-13 17:03 916java中的继承问题,以为是学会了java,结果最简单的一个j ... -
java解惑(谜题76。。)
2011-03-09 11:22 1221谜题76:乒乓public class PingPong { ... -
java解惑(谜题60,65)
2011-03-08 15:52 919一行以毙之 1,编写一个 ... -
java解惑(谜题66。。。)
2011-02-28 20:54 956谜题66:一件私事 class Base{ public ... -
java解惑(谜题61。。。)
2011-02-28 20:17 916谜题61:日期游戏 import java.util.Cal ... -
java解惑(谜题56到。。库之谜)
2011-02-28 19:41 860谜题56:大问题 import jav ... -
java解惑(谜题49。。)
2011-02-27 10:52 954谜题49:比生命更大 import java.util.Cal ... -
java解惑(谜题41到谜题)
2011-02-27 10:18 922谜题41:域和流 下面的 ... -
谜题36-谜题
2011-02-25 10:55 902谜题36:优柔寡断 public ...
相关推荐
Java是企业级应用开发的...这些面试题涵盖了Java基础、集合框架、多线程、网络编程、Servlet和JSP等多个核心领域,全面展示了开发者应该具备的技能和知识。理解和掌握这些内容对于成为一名优秀的Java开发人员至关重要。
jsp servlet面试题总结 jsp 中九大内置对象为: 1. request 请求对象,类型 javax.servlet.ServletRequest,作用域 Request 2. response 响应对象,类型 javax.servlet.SrvletResponse,作用域 Page 3. ...
│ 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和Android面试题涵盖了许多核心概念,以下是这些知识点的详细说明: 1. **面向对象** (Object-Oriented Analysis and Design Principle, OOADP): 面向对象编程是Java和Android开发的基础,它涉及类、对象、继承...
常考面试题 1.讲下servlet的执行流程。 Servlet的执行流程也就是servlet的生命周期,当服务器启动的时候生命周期开始,然后通过init()《启动顺序根据web.xml里的startup-on-load来确定加载顺序》 方法初始化...
在`destroy()`方法中,开发者可以编写代码来释放Servlet在`init()`方法中分配的资源,确保所有资源得到妥善处理。 ### GET与POST请求方式的区别 GET和POST是最常见的两种HTTP请求方法,它们在实际开发中有不同的...
5. **Servlet面试题**: - Servlet的生命周期,包括初始化、服务和销毁方法。 - Servlet的多线程问题,如何处理并发请求? - Servlet配置文件web.xml中,servlet和servlet-mapping元素的作用。 - 什么是Filter和...
Java重点面试题 – 针对java面试过程中经常遇到的一些试题进行总结.docx JAVA面试基础知识点总结.docx Java面试笔记.docx 写出正则表达式,从一个字符串中提取链接地址.docx 出现几率最高和覆盖范围最广的一套经典...
### Java高级工程师面试知识点解析 #### JSP与Servlet的异同及联系 - **相同点**:JSP和Servlet都属于Java Web开发的核心技术之一,主要用于动态网页的生成。 - **不同点**: - **本质区别**:JSP本质上是简化版...
文件中包含了本人最近在网上总结的面试题,有java面试题,jq面试题,jsp、servlet、ajax面试题,mysql面试题,oracle面试题,redis教案,也有最近时间总结的公司面试题,涉及的层面虽然不是很多,但是应对面试 应该...
这些面试题涵盖了Servlet的基础知识,包括HTML、JSP和JavaBean。理解并熟练掌握这些概念对于Java Web开发者来说非常重要,因为它们是构建动态网页和应用程序的基础。在面试中,能够正确解答这些问题将展示出你对Java...
Java面试题19.Servlet中forward和redirect的区别 Java面试题20.jsp和Servlet的相同点和不同点 Java面试题21.内置对象和四大作用域和页面传值 Java面试题22.Session和Cookie的区别和使用场景 Java面试题23.mvc模式和...
"Java面试题及答案详解" Java是目前最流行的编程语言之一,在软件开发行业中广泛应用。以下是Java面试题及答案的详解: Java基础 1. JDK 和 JRE 的区别是什么? JDK(Java Development Kit)是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...
Java 程序员经典面试题 本资源为Java程序员面试必备资料,涵盖了Java基础、线程编程、JSP、Servlet、JDBC、JDO、EJB、应用服务器、J2EE、MVC、设计模式等多个方面的知识点,旨在帮助Java程序员更好地准备面试,获得...
- **Servlet 面试题**: 重点在于 Servlet 生命周期、请求处理机制等。 - **Struts 面试题**: 涉及 MVC 架构、配置文件解析、拦截器等。 - **Spring 面试题**: 包括依赖注入、AOP、事务管理等核心概念。 - **...
Java是一种广泛应用的编程语言,Java面试题涵盖了Java基础知识、Java面向对象编程、Java集合框架、Java多线程编程、Java网络编程等多个方面。下面是对Java经典笔面试题的解读: 一、面向对象的特征 1. 抽象:抽象...
Java基础、Java集合、多线程、JDBC、HTTP、JSP、Servlet、Struts面试题汇总(附答案).docx java工程师面试题大全-100%公司笔试题你都能碰到几个.docx Java开发工程师上机笔试题.docx Java开发求职面试题.docx Java...