`
sakakokiya
  • 浏览: 516033 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

国外的一些struts面试题(4)

阅读更多
Question: Can I setup Apache Struts to use multiple configuration files?
Answer: Yes Struts can use multiple configuration files. Here is the configuration example:
<servlet>
<servlet-name>banking</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml,
/WEB-INF/struts-authentication.xml,
/WEB-INF/struts-help.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Question: What are the disadvantages of Struts?
Answer: Struts is very robust framework and is being used extensively in the industry. But there are some disadvantages of the Struts:
a) High Learning Curve
Struts requires lot of efforts to learn and master it. For any small project less experience developers could spend more time on learning the Struts.
b) Harder to learn
Struts are harder to learn, benchmark and optimize.
Question: What is Struts Flow?
Answer: Struts Flow is a port of Cocoon's Control Flow to Struts to allow complex workflow, like multi-form wizards, to be easily implemented using continuations-capable JavaScript. It provides the ability to describe the order of Web pages that have to be sent to the client, at any given point in time in an application. The code is based on a proof-of-concept Dave Johnson put together to show how the Control Flow could be extracted from Cocoon. (Ref: http://struts.sourceforge.net/struts-flow/index.html )
Question: What are the difference between <bean:message> and <bean:write>?
Answer: <bean:message>: This tag is used to output locale-specific text (from the properties files) from a MessageResources bundle.
<bean:write>: This tag is used to output property values from a bean. <bean:write> is a commonly used tag which enables the programmers to easily present the data.
Question: What is LookupDispatchAction?
Answer: An abstract Action that dispatches to the subclass mapped execute method. This is useful in cases where an HTML form has multiple submit buttons with the same name. The button name is specified by the parameter property of the corresponding ActionMapping. (Ref. http://struts.apache.org/1.2.7/api/org/apache/struts/actions/LookupDispatchAction.html).
Question: What are the components of Struts?
Answer: Struts is based on the MVC design pattern. Struts components can be categories into Model, View and Controller.
Model: Components like business logic / business processes and data are the part of Model.
View: JSP, HTML etc. are part of View
Controller: Action Servlet of Struts is part of Controller components which works as front controller to handle all the requests.
Question: What are Tag Libraries provided with Struts?
Answer: Struts provides a number of tag libraries that helps to create view components easily. These tag libraries are:
a) Bean Tags: Bean Tags are used to access the beans and their properties.
b) HTML Tags: HTML Tags provides tags for creating the view components like forms, buttons, etc..
c) Logic Tags: Logic Tags provides presentation logics that eliminate the need for scriptlets.
d) Nested Tags: Nested Tags helps to work with the nested context.
Question: What are the core classes of the Struts Framework?
Answer: Core classes of Struts Framework are ActionForm, Action, ActionMapping, ActionForward, ActionServlet etc.
Question: What are difference between ActionErrors and ActionMessage?
Answer: ActionMessage: A class that encapsulates messages. Messages can be either global or they are specific to a particular bean property.
Each individual message is described by an ActionMessage object, which contains a message key (to be looked up in an appropriate message resources database), and up to four placeholder arguments used for parametric substitution in the resulting message.
ActionErrors: A class that encapsulates the error messages being reported by the validate() method of an ActionForm. Validation errors are either global to the entire ActionForm bean they are associated with, or they are specific to a particular bean property (and, therefore, a particular input field on the corresponding form).
Question: How you will handle exceptions in Struts?
Answer: In Struts you can handle the exceptions in two ways:
a) Declarative Exception Handling: You can either define global exception handling tags in your struts-config.xml or define the exception handling tags within <action>..</action> tag.
Example:
<exception
key=”database.error.duplicate”
path=”/UserExists.jsp”
type=”mybank.account.DuplicateUserException”/>
b) Programmatic Exception Handling: Here you can use try{}catch{} block to handle the exception.
分享到:
评论

相关推荐

    struts面试题详解

    在深入探讨Struts面试题之前,我们首先理解Struts1的基本架构和工作原理。 **1. Struts1框架的核心组件:** - **ActionServlet**:这是Struts1的核心控制器,它是一个实现了Servlet接口的类。当用户发起HTTP请求时...

    struts2面试题

    Struts2 面试题 Struts2 是基于 Java 语言的 Web 应用程序框架,继承自 WebWork 框架。Struts2 的主要特点是使用 FilterDispatcher 作为核心控制器,将请求分发到相应的 Action 中。下面是 Struts2 面试题中涉及到...

    JAVA笔试面试资料JDBC HTTP、JSP、Servlet、Struts面试题汇总资料.zip

    JAVA笔试面试资料JDBC HTTP、JSP、Servlet、Struts面试题汇总资料: 2014年最新Java笔试题及答案.docx 225道Java面试题 学会了Java面试随你问.docx Ant和Maven的作用是什么?...遇到的一些Java面试题回顾.docx

    struts2面试题(个人四处搜集,吐血推荐).

    标题中提到的是“struts2面试题”,所以本文的知识点将围绕Struts2框架的面试常见问题展开,包括基础知识点、常用类和工作流程等。 首先,我们需要了解Struts2框架的基础概念。Struts2是一个用于创建企业级Java Web...

    struts1面试题

    以上就是关于Struts1面试题的一些核心知识点,包括其初始化流程、处理用户请求的步骤、数据验证机制以及配置文件中的元素详解。这些内容涵盖了Struts1的基本架构和工作原理,对于理解和解答相关面试问题非常关键。

    Struts2面试题及答案

    ### Struts2面试题及答案解析 #### 一、Struts2框架执行流程与核心组件 **题目背景:** 在Struts2框架中,FilterDispatcher是核心组件之一,它负责处理用户请求,并调用相应的Action进行业务逻辑处理。相较于...

    struts2面试题(本人面试题)

    ### Struts1与Struts2的关键区别及其工作流程详解 #### Struts1关键组件与工作流程 **核心组件:** - **ActionServlet:** Struts1的核心控制器,它负责接收HTTP请求,并将其转发到相应的Action。 - **...

    Struts2基础面试题

    ### Struts2基础面试题详解 #### 1. Struts2的核心控制器及其性质 - **Struts1的核心控制器**:在Struts1框架中,核心控制器是`ActionServlet`,这是一个实现了`HttpServlet`接口的类,因此本质上是一个Servlet。 ...

    Struts2 框架面试题.CHM

    持续更新ing Struts2 框架面试题汇总。 Struts2 基于 MVC 架构,框架结构清晰,使用 OGNL,提供了全局范围、包范围和Action范围的国际化资源文件管理实现。

    Struts2面试题

    ### Struts2面试题知识点详解 #### 一、Struts2的工作流程 1. **请求接收**:所有的请求首先会被`StrutsPrepareAndExecuteFilter`接收。 2. **请求识别**:`StrutsPrepareAndExecuteFilter`判断这个请求是否属于...

    struts2框架面试题

    #### 二、Struts2框架中的绳子问题(武汉晨安科技笔试题) 题目描述了一个经典的面试问题:“如何通过燃烧两条不均匀的绳子来计算出15分钟的时间?”解答此题的关键在于理解绳子燃烧的速度不是均匀的这一前提。具体...

    大量的Struts面试题集合

    以下是一些Struts面试题及相关的知识点解析: 1. **什么是Struts框架?** Struts是一个开源的MVC框架,它基于Model-View-Controller设计模式,旨在提高Java Web应用的可维护性和可扩展性。它提供了请求处理、页面...

    2014 java servet jdbc struts struts2面试题

    【Struts2面试题】 1. **Struts2架构**:基于MVC模式,了解Action、Result、Interceptor等核心组件。 2. **Struts2拦截器**:自定义拦截器,理解默认拦截器栈及其作用。 3. **Struts2配置**:struts.xml文件,...

    最全的IT公司面试题集 CHM版的

    外企面试,软件测试面试题,Python面试题,Oracle面试题,MySql面试题,Web开发面试题,Unix面试题,程序员面试,网络技术面试题,网络安全面试题,Linux面试题,Hibernate面试题,Spring面试题,SQL Server面试题,Struts面试题,...

    struts面试题大全.doc

    面试中关于Struts的问题通常会涉及其核心概念、优缺点、处理流程以及关键对象的作用。下面是对这些知识点的详细解释: 1. **Struts 优点与缺点**: - **优点**: - 开源社区支持,丰富的学习资源。 - Taglib...

    struts基础面试笔试题及其答案

    Struts 是一个开源的Java Web框架,由Apache软件基金会维护,主要用于构建企业级...以上是关于Struts基础的一些常见面试题和答案,深入理解和掌握这些概念对于Java Web开发者来说非常重要,尤其是在处理企业级应用时。

    java面试题,J2EE面试题 笔试题

    4、J2EE面试题(打码查错题) 5、java_华为笔试题 6、java常见面试题 7、java程序员面试宝典 8、java面试题及答案 9、java面试题编程篇 10、Oracle面试题 11、Oracle企业面试题集锦 12、Spring面试题 13、SSH面试题 ...

    最新Struts和Hibernate和Spring经典面试题

    Struts、Hibernate 和 Spring 经典面试题 以下是对 Struts、Hibernate 和 Spring 的经典面试题的总结,涵盖了这些框架的工作机制、优点、缓存机制、查询方式、优化方法等知识点。 Hibernate 1. Hibernate 工作...

Global site tag (gtag.js) - Google Analytics