`
as619864232
  • 浏览: 324318 次
社区版块
存档分类
最新评论

Struts2 中 web.xml 的翻译

阅读更多

 

The web.xml web application descriptor file represents the core of the Java web application, so it is appropriate(占用) that it is also part of the core of the Struts framework. In the web.xml file, Struts defines its FilterDispatcher(分配器), the Servlet Filter class that initializes the Struts framework and handles(操纵) all requests. This filter can contain initialization parameters that affect what, if any(即便有), additional(附加的) configuration files are loaded and how the framework should behave(运转).

In addition to the FilterDispatcher, Struts also provides an ActionContextCleanUp class that(以至于) handles special cleanup tasks when other filters, such as those used by Sitemesh(由一个基于Web页面布局、装饰以及与现存Web应用整合的框架), need access(使用) to an initialized Struts framework.

Key Initialization Parameters

 

  • config - a comma-delimited(逗号分隔) list of XML configuration files to load.

  • actionPackages - a comma-delimited list of Java packages to scan(扫描) for Actions.

  • configProviders - a comma-delimited list of Java classes that implement the ConfigurationProvider interface that should be used for building the Configuration.

  • loggerFactory - The class name of the LoggerFactory implementation.

  • * - any other parameters are treated as framework constants.

 

 

Why the Filter is mapped with /* and how to configure explicit exclusions (since 2.1.7)

In the example above we've mapped the Struts 2 dispatcher to /*, so Struts 2 has a crack at all incoming requests. This is because Struts 2 serves static content from its jar files, including Dojo(一个强大的面向对象JavaScript框架。主要由三大模块组成:Core、Dijit、DojoXJavaScript files (if using S2.0, or the Dojo plugin in S2.1+) and FreeMarker(一个模板引擎,一个基于模板生成文本输出的通用工具,使用纯Java编写) templates for the Struts 2 tags that produce HTML.

If we change the filter mapping to something else, for example /*.html, we must take this in to account and extract the content that would normally be served from the Struts 2 jar files, or some other solution.

 

Since Struts 2.1.7, you are able to provide a comma seperated list of patterns(模式) for which when matching against the

request URL the Filter will just pass by. This is done via the configuration option struts.action.excludePattern, for example in your struts.xml.

 

<struts>
    <constant name="struts.action.excludePattern" value=".*unfiltered.*,.*\\.nofilter"/>
    ...

</struts>
分享到:
评论

相关推荐

    struts1中web.xml配置详解

    struts1 中 web.xml 配置详解 struts1 框架是一种基于 Java 语言的 Web 应用程序开发框架,它提供了一个灵活的、可扩展的框架来开发基于 Web 的应用程序。在 struts1 框架中,web.xml 文件是必不可少的配置文件之一...

    spring在web.xml中和在struts中的不同配置..pdf

    在本文中,我们将探讨Spring在`web.xml`中的配置与在Struts中的配置差异,以及这两种配置方式背后的基本原理。 首先,Spring的核心是ApplicationContext,它是一个管理Bean的容器,可以看作是应用程序的上下文环境...

    struts.xml和applicationContext.xml、web.xml的配置

    在Java Web开发中,`struts.xml`, `applicationContext.xml` 和 `web.xml` 是三个至关重要的配置文件,它们各自负责不同的职责,并协同工作来构建一个完整的应用框架。以下是关于这三个配置文件的详细说明。 首先,...

    struts2的web.xml配置文件

    以前和struts2一起使用的配置文件,struts2的核心控制器

    struts2.5 web.xml配置

    在探讨Struts2.5中的`web.xml`配置时,我们首先需要理解`web.xml`在Java Web应用中的角色以及它如何与Struts框架交互。`web.xml`是Java Web应用的核心配置文件之一,用于定义应用程序级别的配置信息,如过滤器、监听...

    javaweb项目中web.xml的作用

    javaweb项目中web.xml的作用 web.xml是javaweb项目中一个非常重要的配置文件,它是每一个javaWeb工程都必需的配置文件。web.xml文件的主要作用是用于初始化工程配置信息,例如welcome页面、filter、listener、...

    org.springframework.web.struts-3.1.0.M2.jar

    同时,Struts的配置文件(struts-config.xml或struts2的struts.xml)也需要进行相应的调整,引入Spring的插件和配置信息。 `springframework-license.txt`文件则包含了Spring框架的许可协议,它规定了软件的使用、...

    flex4,struts2.3兼容配置web.xml

    flex4,struts2.3兼容配置web.xml

    Struts框架中struts-config.xml文件配置小结

    ### Struts框架中struts-config.xml文件配置详解 #### 一、引言 在Java Web开发领域,Struts是一个非常重要的MVC(Model-View-Controller)框架,它极大地简化了Web应用程序的开发过程。而在Struts框架中,`struts...

    struts.xml文件详解.doc

    struts.properties中的属性也可以在web.xml或struts.xml中进行配置。在web.xml中,你可以使用"init-param"标签,而在struts.xml中,你可以使用"constant"标签来设置这些属性。这样做提供了更大的灵活性,让开发者...

    在web.xml中配置action或.do

    ### 在web.xml中配置action或.do的理解与实践 #### 一、引言 在Web开发领域,特别是基于Java的Web应用程序开发中,`web.xml`文件扮演着至关重要的角色。它不仅定义了Web应用的基本配置,还管理着诸如Servlet、过滤...

    Struts2手动搭建所有的jar包及相应的struts.xml和web.xml

    本教程将详细讲解如何手动搭建一个完整的Struts2环境,包括引入所有必要的jar包以及配置struts.xml和web.xml文件。 首先,我们需要准备Struts2的核心库。Struts2框架依赖于一系列的jar包,这些包包含了从控制器到...

    Web.xml中配置Struts[参考].pdf

    Struts框架在Web.xml中的配置 Struts框架是Java EE中的一种基于MVC模式的Web应用程序框架,它提供了一个灵活的架构,可以快速开发Web应用程序。在Struts框架中,配置文件Web.xml是核心配置文件之一,本文将详细介绍...

    flex4,struts2.3兼容配置web.xml中的filter

    flex4,struts2.3兼容配置web.xml中的filter

    sruts2.0 web.xml 配置文件

    `web.xml`配置文件在Struts2中扮演着至关重要的角色,它是整个应用的部署描述符,定义了应用程序的入口点、过滤器、Servlet以及其他Web组件的配置信息。在这里,我们将深入探讨`web.xml`配置文件在Struts2中的应用...

    struts、applicationContext配置文件移动后web.xml配置示例

    使用myeclipse8.5搭建SSH后,将struts.xml和applicationContext.xml移动到别的地方,示例中为webroot下的config文件夹中,web.xml中需要做的修改示例。其中对于返回上一层方式不同的myeclipse可能不同,如有的用../...

    struts.xml和struts.properties配置详解

    在Struts中,`struts.xml`和`struts.properties`文件是两个核心的配置文件,它们分别负责定义应用的行为和设置全局属性。 **`struts.xml`配置详解** `struts.xml`是Struts 2框架的核心配置文件,用于定义动作映射...

    Web.xml中配置Struts[文].pdf

    7. Filter配置:虽然不是直接在`web.xml`中配置Struts,但Struts2引入了Filter的概念,`struts2-core.jar`包含了一个名为`StrutsPrepareAndExecuteFilter`的Filter,用来处理所有的HTTP请求,替代了Struts1中的...

    Struts2.5版本struts.xml与web.xml配置的更改方法

    在Struts2框架中,配置文件`struts.xml`和`web.xml`是核心部分,它们定义了应用程序的行为和路由规则。随着版本的更新,配置方式也会有所改变。以下是Struts2.5版本中`struts.xml`和`web.xml`配置的更改方法: **1....

    struts2.0中struts.xml配置文件详解

    包是Struts2中用来组织Action、拦截器和其他配置的一种方式。例如: ```xml &lt;package name="com.kay.struts2" extends="struts-default" namespace="/test"&gt; ``` - `name`属性:包的名字。 - `extends`属性:继承...

Global site tag (gtag.js) - Google Analytics