- 浏览: 516042 次
- 性别:
- 来自: 北京
-
文章分类
- 全部博客 (672)
- 随便写写 (3)
- javascript (16)
- Java exam (58)
- JSP exam (25)
- Servlet exam (25)
- Struts exam (24)
- Spring exam (24)
- Hibernate exam (19)
- EJB exam (25)
- SOA exam (6)
- AJAX exam (25)
- Web开发 exam (25)
- 软件工程 exam (25)
- 项目管理 exam (25)
- .NET exam (23)
- ASP.NET exam (24)
- C# exam (24)
- C++ exam (25)
- C语言 exam (13)
- ASP exam (0)
- PHP exam (0)
- Ruby exam (0)
- Python exam (0)
- Delphi exam (0)
- Linux exam (0)
- UNIX exam (25)
- 数据库 exam (24)
- Oracle exam (25)
- SQL Server exam (20)
- MySQL exam (16)
- Mobile开发 exam (10)
- 嵌入式开发 exam (6)
- 网络安全 exam (0)
- 网络技术 exam (0)
- 综合技术 exam (0)
- HR面试 exam (0)
- 英语面试 exam (0)
- 外企面试 exam (0)
- 软件测试 exam (0)
- QTP exam (0)
- LoadRunner exam (0)
- 网友面经 exam (0)
- 应届生 exam (0)
- 面试指导 exam (0)
- IQ测试 exam (0)
- Flex exam (2)
- uml-ea (1)
最新评论
-
dxking100:
远光没有笔式题的说..
最新远光软件笔试题面试题内容(1) -
heming_way:
谢谢,正在复习软件工程考试呢,呵呵
《软件工程》选择题 -
梅玲达:
可以更详细点吗?
Hibernate中Criteria 和DetachedCriteria的作用是什么? -
buptjian:
学习下,试试看,谢谢啊~
Prototype如何实现页面局部定时刷新? -
bubblegum89:
这个。。。和我笔试时候做的 感觉完全不一样
最新远光软件笔试题面试题内容(3)
Question: Why cant we overide create method in StatelessSessionBean?
Answer: From the EJB Spec : - A Session bean's home interface defines one or morecreate(…) methods. Each create method must be named create and must match one of the ejbCreate methods defined in the enterprise Bean class. The return type of a create method must be the enterprise Bean's remote interface type. The home interface of a stateless session bean must have one create method that takes no arguments.
Question: Is struts threadsafe?Give an example?
Answer: Struts is not only thread-safe but thread-dependant. The response to a request is handled by a light-weight Action object, rather than an individual servlet. Struts instantiates each Action class once, and allows other requests to be threaded through the original object. This core strategy conserves resources and provides the best possible throughput. A properly-designed application will exploit this further by routing related operations through a single Action.
Question: Can we Serialize static variable?
Answer: Serialization is the process of converting a set of object instances that contain references to each other into a linear stream of bytes, which can then be sent through a socket, stored to a file, or simply manipulated as a stream of data. Serialization is the mechanism used by RMI to pass objects between JVMs, either as arguments in a method invocation from a client to a server or as return values from a method invocation. In the first section of this book, There are three exceptions in which serialization doesnot necessarily read and write to the stream. These are
1. Serialization ignores static fields, because they are not part of any particular object's state.
2. Base class fields are only handled if the base class itself is serializable.
3. Transient fields. There are four basic things you must do when you are making a class serializable. They are:
1. Implement the Serializable interface.
2. Make sure that instance-level, locally defined state is serialized properly.
3. Make sure that superclass state is serialized properly.
4. Override equals( )and hashCode( ).
it is possible to have control over serialization process. The class should implement Externalizable interface. This interface contains two methods namely readExternal and writeExternal. You should implement these methods and write the logic for customizing the serialization process …. (Source: http://www.oreilly.com/catalog/javarmi/chapter/ch10.html)
Question: What are the uses of tiles-def.xml file, resourcebundle.properties file, validation.xml file?
Answer: tiles-def.xml is is an xml file used to configure tiles with the struts application. You can define the layout / header / footer / body content for your View. See more at http://www.roseindia.net/struts/using-tiles-defs-xml.shtml.
The resourcebundle.properties file is used to configure the message (error/ other messages) for the struts applications.
The file validation.xml is used to declare sets of validations that should be applied to Form Beans. Fpr more information please visit http://www.roseindia.net/struts/address_struts_validator.shtml.
Question: What is the difference between perform() and execute() methods?
Answer: Perform method is the method which was deprecated in the Struts Version 1.1. In Struts 1.x, Action.perform() is the method called by the ActionServlet. This is typically where your business logic resides, or at least the flow control to your JavaBeans and EJBs that handle your business logic. As we already mentioned, to support declarative exception handling, the method signature changed in perform. Now execute just throws Exception. Action.perform() is now deprecated; however, the Struts v1.1 ActionServlet is smart enough to know whether or not it should call perform or execute in the Action, depending on which one is available.
Question: What are the various Struts tag libraries?
Answer: Struts is very rich framework and it provides very good and user friendly way to develop web application forms. Struts provide many tag libraries to ease the development of web applications. These tag libraries are:
* Bean tag library - Tags for accessing JavaBeans and their properties.
* HTML tag library - Tags to output standard HTML, including forms, text boxes, checkboxes, radio buttons etc..
* Logic tag library - Tags for generating conditional output, iteration capabilities and flow management
* Tiles or Template tag library - For the application using tiles
* Nested tag library - For using the nested beans in the application
Question: What do you understand by DispatchAction?
Answer: DispatchAction is an action that comes with Struts 1.1 or later, that lets you combine Struts actions into one class, each with their own method. The org.apache.struts.action.DispatchAction class allows multiple operation to mapped to the different functions in the same Action class.
For example:
A package might include separate RegCreate, RegSave, and RegDelete Actions, which just perform different operations on the same RegBean object. Since all of these operations are usually handled by the same JSP page, it would be handy to also have them handled by the same Struts Action.
A very simple way to do this is to have the submit button modify a field in the form which indicates which operation to perform.
<html:hidden property=”dispatch” value=”error”/>
<SCRIPT>function set(target) {document.forms[0].dispatch.value=target;}</SCRIPT>
<html:submit onclick=”set('save');”>SAVE</html:submit>
<html:submit onclick=”set('create');”>SAVE AS NEW</html:submitl>
<html:submit onclick=”set('delete);”>DELETE</html:submit>
Then, in the Action you can setup different methods to handle the different operations, and branch to one or the other depending on which value is passed in the dispatch field.
String dispatch = myForm.getDispatch();
if (”create”.equals(dispatch)) { …
if (”save”.equals(dispatch)) { …
The Struts Dispatch Action [org.apache.struts.actions] is designed to do exactly the same thing, but without messy branching logic. The base perform method will check a dispatch field for you, and invoke the indicated method. The only catch is that the dispatch methods must use the same signature as perform. This is a very modest requirement, since in practice you usually end up doing that anyway.
To convert an Action that was switching on a dispatch field to a DispatchAction, you simply need to create methods like this
public ActionForward create(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException { …
public ActionForward save(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException { …
Cool. But do you have to use a property named dispatch? No, you don't. The only other step is to specify the name of of the dispatch property as the “parameter” property of the action-mapping. So a mapping for our example might look like this:
<action
path=”/reg/dispatch”
type=”app.reg.RegDispatch”
name=”regForm”
scope=”request”
validate=”true”
parameter=”dispatch”/>
If you wanted to use the property “o” instead, as in o=create, you would change the mapping to
<action
path=”/reg/dispatch”
type=”app.reg.RegDispatch”
name=”regForm”
scope=”request”
validate=”true”
parameter=”o”/>
Again, very cool. But why use a JavaScript button in the first place? Why not use several buttons named “dispatch” and use a different value for each?
You can, but the value of the button is also its label. This means if the page designers want to label the button something different, they have to coordinate the Action programmer. Localization becomes virtually impossible. (Source: http://husted.com/struts/tips/002.html).
Question: How Struts relates to J2EE?
Answer: Struts framework is built on J2EE technologies (JSP, Servlet, Taglibs), but it is itself not part of the J2EE standard.
Question: What is Struts actions and action mappings?
Answer: A Struts action is an instance of a subclass of an Action class, which implements a portion of a Web application and whose perform or execute method returns a forward.
An action can perform tasks such as validating a user name and password.
An action mapping is a configuration file entry that, in general, associates an action name with an action. An action mapping can contain a reference to a form bean that the action can use, and can additionally define a list of local forwards that is visible only to this action.
An action servlet is a servlet that is started by the servlet container of a Web server to process a request that invokes an action. The servlet receives a forward from the action and asks the servlet container to pass the request to the forward's URL. An action servlet must be an instance of an org.apache.struts.action.ActionServlet class or of a subclass of that class. An action servlet is the primary component of the controller.
Answer: From the EJB Spec : - A Session bean's home interface defines one or morecreate(…) methods. Each create method must be named create and must match one of the ejbCreate methods defined in the enterprise Bean class. The return type of a create method must be the enterprise Bean's remote interface type. The home interface of a stateless session bean must have one create method that takes no arguments.
Question: Is struts threadsafe?Give an example?
Answer: Struts is not only thread-safe but thread-dependant. The response to a request is handled by a light-weight Action object, rather than an individual servlet. Struts instantiates each Action class once, and allows other requests to be threaded through the original object. This core strategy conserves resources and provides the best possible throughput. A properly-designed application will exploit this further by routing related operations through a single Action.
Question: Can we Serialize static variable?
Answer: Serialization is the process of converting a set of object instances that contain references to each other into a linear stream of bytes, which can then be sent through a socket, stored to a file, or simply manipulated as a stream of data. Serialization is the mechanism used by RMI to pass objects between JVMs, either as arguments in a method invocation from a client to a server or as return values from a method invocation. In the first section of this book, There are three exceptions in which serialization doesnot necessarily read and write to the stream. These are
1. Serialization ignores static fields, because they are not part of any particular object's state.
2. Base class fields are only handled if the base class itself is serializable.
3. Transient fields. There are four basic things you must do when you are making a class serializable. They are:
1. Implement the Serializable interface.
2. Make sure that instance-level, locally defined state is serialized properly.
3. Make sure that superclass state is serialized properly.
4. Override equals( )and hashCode( ).
it is possible to have control over serialization process. The class should implement Externalizable interface. This interface contains two methods namely readExternal and writeExternal. You should implement these methods and write the logic for customizing the serialization process …. (Source: http://www.oreilly.com/catalog/javarmi/chapter/ch10.html)
Question: What are the uses of tiles-def.xml file, resourcebundle.properties file, validation.xml file?
Answer: tiles-def.xml is is an xml file used to configure tiles with the struts application. You can define the layout / header / footer / body content for your View. See more at http://www.roseindia.net/struts/using-tiles-defs-xml.shtml.
The resourcebundle.properties file is used to configure the message (error/ other messages) for the struts applications.
The file validation.xml is used to declare sets of validations that should be applied to Form Beans. Fpr more information please visit http://www.roseindia.net/struts/address_struts_validator.shtml.
Question: What is the difference between perform() and execute() methods?
Answer: Perform method is the method which was deprecated in the Struts Version 1.1. In Struts 1.x, Action.perform() is the method called by the ActionServlet. This is typically where your business logic resides, or at least the flow control to your JavaBeans and EJBs that handle your business logic. As we already mentioned, to support declarative exception handling, the method signature changed in perform. Now execute just throws Exception. Action.perform() is now deprecated; however, the Struts v1.1 ActionServlet is smart enough to know whether or not it should call perform or execute in the Action, depending on which one is available.
Question: What are the various Struts tag libraries?
Answer: Struts is very rich framework and it provides very good and user friendly way to develop web application forms. Struts provide many tag libraries to ease the development of web applications. These tag libraries are:
* Bean tag library - Tags for accessing JavaBeans and their properties.
* HTML tag library - Tags to output standard HTML, including forms, text boxes, checkboxes, radio buttons etc..
* Logic tag library - Tags for generating conditional output, iteration capabilities and flow management
* Tiles or Template tag library - For the application using tiles
* Nested tag library - For using the nested beans in the application
Question: What do you understand by DispatchAction?
Answer: DispatchAction is an action that comes with Struts 1.1 or later, that lets you combine Struts actions into one class, each with their own method. The org.apache.struts.action.DispatchAction class allows multiple operation to mapped to the different functions in the same Action class.
For example:
A package might include separate RegCreate, RegSave, and RegDelete Actions, which just perform different operations on the same RegBean object. Since all of these operations are usually handled by the same JSP page, it would be handy to also have them handled by the same Struts Action.
A very simple way to do this is to have the submit button modify a field in the form which indicates which operation to perform.
<html:hidden property=”dispatch” value=”error”/>
<SCRIPT>function set(target) {document.forms[0].dispatch.value=target;}</SCRIPT>
<html:submit onclick=”set('save');”>SAVE</html:submit>
<html:submit onclick=”set('create');”>SAVE AS NEW</html:submitl>
<html:submit onclick=”set('delete);”>DELETE</html:submit>
Then, in the Action you can setup different methods to handle the different operations, and branch to one or the other depending on which value is passed in the dispatch field.
String dispatch = myForm.getDispatch();
if (”create”.equals(dispatch)) { …
if (”save”.equals(dispatch)) { …
The Struts Dispatch Action [org.apache.struts.actions] is designed to do exactly the same thing, but without messy branching logic. The base perform method will check a dispatch field for you, and invoke the indicated method. The only catch is that the dispatch methods must use the same signature as perform. This is a very modest requirement, since in practice you usually end up doing that anyway.
To convert an Action that was switching on a dispatch field to a DispatchAction, you simply need to create methods like this
public ActionForward create(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException { …
public ActionForward save(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException { …
Cool. But do you have to use a property named dispatch? No, you don't. The only other step is to specify the name of of the dispatch property as the “parameter” property of the action-mapping. So a mapping for our example might look like this:
<action
path=”/reg/dispatch”
type=”app.reg.RegDispatch”
name=”regForm”
scope=”request”
validate=”true”
parameter=”dispatch”/>
If you wanted to use the property “o” instead, as in o=create, you would change the mapping to
<action
path=”/reg/dispatch”
type=”app.reg.RegDispatch”
name=”regForm”
scope=”request”
validate=”true”
parameter=”o”/>
Again, very cool. But why use a JavaScript button in the first place? Why not use several buttons named “dispatch” and use a different value for each?
You can, but the value of the button is also its label. This means if the page designers want to label the button something different, they have to coordinate the Action programmer. Localization becomes virtually impossible. (Source: http://husted.com/struts/tips/002.html).
Question: How Struts relates to J2EE?
Answer: Struts framework is built on J2EE technologies (JSP, Servlet, Taglibs), but it is itself not part of the J2EE standard.
Question: What is Struts actions and action mappings?
Answer: A Struts action is an instance of a subclass of an Action class, which implements a portion of a Web application and whose perform or execute method returns a forward.
An action can perform tasks such as validating a user name and password.
An action mapping is a configuration file entry that, in general, associates an action name with an action. An action mapping can contain a reference to a form bean that the action can use, and can additionally define a list of local forwards that is visible only to this action.
An action servlet is a servlet that is started by the servlet container of a Web server to process a request that invokes an action. The servlet receives a forward from the action and asks the servlet container to pass the request to the forward's URL. An action servlet must be an instance of an org.apache.struts.action.ActionServlet class or of a subclass of that class. An action servlet is the primary component of the controller.
发表评论
-
一组Struts的选择测试题附答案(1)
2010-08-12 16:34 373(1)在Struts应用的视图中包含哪些组件?(多选)选项:( ... -
如何在struts中配置数据源在,什么文件?用什么标签?如何取出DataSource?
2010-08-12 16:34 746Struts-config.xml<data-sourc ... -
Struts中最核心的类和包有哪些?
2010-08-12 16:34 6211. org.apache.struts.action基本上, ... -
国外的一些struts面试题(2)
2010-08-12 16:34 693Question: What is RequestProces ... -
Difference between Chain and Redirect Action result types
2010-08-12 16:34 377Chain result type is used for A ... -
如何提高Struts2的性能?
2010-08-12 16:34 6241. 关闭logging和开发模式(devMode), dev ... -
Spring和Struts的区别?
2010-08-12 16:34 731strusts:是一种基于MVC模式的一个web层的处理。Sp ... -
struts+spring面试题
2010-08-12 16:34 6851.strutsAction是不是线程安全的?如果不是,有什么 ... -
Struts中如何基于validation.xml来启用客户端验证?
2010-08-12 16:34 398可以使用<html:javascript>标签来进 ... -
国外的一些struts面试题(4)
2010-08-12 16:34 398Question: Can I setup Apache St ... -
介绍一下Struts的ActionServlet类
2010-08-12 16:34 763ActionServlet继承自javax.servlet.h ... -
Struts,Spring,Hibernate面试题总结
2010-08-12 16:34 413转载地址:http://blog.csdn.net/David ... -
一组Struts的选择测试题附答案(2)
2010-08-12 16:34 450(1)假设在helloapp应用中有一个hello.jsp,它 ... -
如何用Struts实现国际化?
2010-08-12 16:34 926国际化:不用修改代码,就适用于不同的语言国家本地化:如果要适应 ... -
介绍一下Struts的Action类
2010-08-12 16:34 415ActionServlet把全部提交的请求都被控制器委托到Re ... -
如何配置spring+struts?
2010-08-12 16:34 465在struts-config.xml加入一个插件,通过它加载a ... -
Struts中DispatchAction和Action类有什么不同?
2010-08-12 16:34 767DispatchAction是Struts包含的另一个能大量节 ... -
Struts框架如何取得消息资源文件中的信息?
2010-08-12 16:34 723消息资源文件是一些简单的.properties文件,这些文件包 ... -
国外的一些struts面试题(1)
2010-08-12 16:34 674Q: What is ActionServlet?A: The ... -
如何实现struts的validator框架?
2010-08-12 16:34 650手动: public class my ...
相关推荐
在深入探讨Struts面试题之前,我们首先理解Struts1的基本架构和工作原理。 **1. Struts1框架的核心组件:** - **ActionServlet**:这是Struts1的核心控制器,它是一个实现了Servlet接口的类。当用户发起HTTP请求时...
Struts2 面试题 Struts2 是基于 Java 语言的 Web 应用程序框架,继承自 WebWork 框架。Struts2 的主要特点是使用 FilterDispatcher 作为核心控制器,将请求分发到相应的 Action 中。下面是 Struts2 面试题中涉及到...
JAVA笔试面试资料JDBC HTTP、JSP、Servlet、Struts面试题汇总资料: 2014年最新Java笔试题及答案.docx 225道Java面试题 学会了Java面试随你问.docx Ant和Maven的作用是什么?...遇到的一些Java面试题回顾.docx
标题中提到的是“struts2面试题”,所以本文的知识点将围绕Struts2框架的面试常见问题展开,包括基础知识点、常用类和工作流程等。 首先,我们需要了解Struts2框架的基础概念。Struts2是一个用于创建企业级Java Web...
以上就是关于Struts1面试题的一些核心知识点,包括其初始化流程、处理用户请求的步骤、数据验证机制以及配置文件中的元素详解。这些内容涵盖了Struts1的基本架构和工作原理,对于理解和解答相关面试问题非常关键。
### Struts2面试题及答案解析 #### 一、Struts2框架执行流程与核心组件 **题目背景:** 在Struts2框架中,FilterDispatcher是核心组件之一,它负责处理用户请求,并调用相应的Action进行业务逻辑处理。相较于...
### Struts1与Struts2的关键区别及其工作流程详解 #### Struts1关键组件与工作流程 **核心组件:** - **ActionServlet:** Struts1的核心控制器,它负责接收HTTP请求,并将其转发到相应的Action。 - **...
### Struts2基础面试题详解 #### 1. Struts2的核心控制器及其性质 - **Struts1的核心控制器**:在Struts1框架中,核心控制器是`ActionServlet`,这是一个实现了`HttpServlet`接口的类,因此本质上是一个Servlet。 ...
持续更新ing Struts2 框架面试题汇总。 Struts2 基于 MVC 架构,框架结构清晰,使用 OGNL,提供了全局范围、包范围和Action范围的国际化资源文件管理实现。
### Struts2面试题知识点详解 #### 一、Struts2的工作流程 1. **请求接收**:所有的请求首先会被`StrutsPrepareAndExecuteFilter`接收。 2. **请求识别**:`StrutsPrepareAndExecuteFilter`判断这个请求是否属于...
#### 二、Struts2框架中的绳子问题(武汉晨安科技笔试题) 题目描述了一个经典的面试问题:“如何通过燃烧两条不均匀的绳子来计算出15分钟的时间?”解答此题的关键在于理解绳子燃烧的速度不是均匀的这一前提。具体...
以下是一些Struts面试题及相关的知识点解析: 1. **什么是Struts框架?** Struts是一个开源的MVC框架,它基于Model-View-Controller设计模式,旨在提高Java Web应用的可维护性和可扩展性。它提供了请求处理、页面...
【Struts2面试题】 1. **Struts2架构**:基于MVC模式,了解Action、Result、Interceptor等核心组件。 2. **Struts2拦截器**:自定义拦截器,理解默认拦截器栈及其作用。 3. **Struts2配置**:struts.xml文件,...
外企面试,软件测试面试题,Python面试题,Oracle面试题,MySql面试题,Web开发面试题,Unix面试题,程序员面试,网络技术面试题,网络安全面试题,Linux面试题,Hibernate面试题,Spring面试题,SQL Server面试题,Struts面试题,...
3. **Struts处理流程**: - 初始化:ActionServlet读取配置文件,初始化ModuleConfig对象。 - 请求处理:接收HTTP请求,根据ActionConfig找到匹配的Action子类。 - 参数填充:ActionForm使用请求参数填充自身,可...
Struts 是一个开源的Java Web框架,由Apache软件基金会维护,主要用于构建企业级...以上是关于Struts基础的一些常见面试题和答案,深入理解和掌握这些概念对于Java Web开发者来说非常重要,尤其是在处理企业级应用时。
3、J2EE初学者面试题 4、J2EE面试题(打码查错题) 5、java_华为笔试题 6、java常见面试题 7、java程序员面试宝典 8、java面试题及答案 9、java面试题编程篇 10、Oracle面试题 11、Oracle企业面试题集锦 12、Spring...
根据给定的信息,我们将深入探讨Struts2框架中的一些核心概念,包括OGNL表达式的使用、ValueStack的理解及其数据存取方法,以及拦截器的生命周期等。 ### OGNL表达式及其三要素 #### OGNL简介 OGNL(Object-Graph ...