| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"/> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"/> |
| <meta name="Date-Revision-yyyymmdd" content="20140918"/> |
| <meta http-equiv="Content-Language" content="en"/> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| |
| <title>Plugins</title> |
| |
| <link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,400italic,600italic,700italic" rel="stylesheet" type="text/css"> |
| <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> |
| <link href="/css/main.css" rel="stylesheet"> |
| <link href="/css/custom.css" rel="stylesheet"> |
| <link href="/highlighter/github-theme.css" rel="stylesheet"> |
| |
| <script src="//code.jquery.com/jquery-1.11.0.min.js"></script> |
| <script type="text/javascript" src="/bootstrap/js/bootstrap.js"></script> |
| <script type="text/javascript" src="/js/community.js"></script> |
| </head> |
| <body> |
| |
| <a href="http://github.com/apache/struts" class="github-ribbon"> |
| <img style="position: absolute; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"> |
| </a> |
| |
| <header> |
| <nav> |
| <div role="navigation" class="navbar navbar-default navbar-fixed-top"> |
| <div class="container"> |
| <div class="navbar-header"> |
| <button type="button" data-toggle="collapse" data-target="#struts-menu" class="navbar-toggle"> |
| Menu |
| <span class="sr-only">Toggle navigation</span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| </button> |
| <a href="/index.html" class="navbar-brand logo"><img src="/img/struts-logo.svg"></a> |
| </div> |
| <div id="struts-menu" class="navbar-collapse collapse"> |
| <ul class="nav navbar-nav"> |
| <li class="dropdown"> |
| <a data-toggle="dropdown" href="#" class="dropdown-toggle"> |
| Home<b class="caret"></b> |
| </a> |
| <ul class="dropdown-menu"> |
| <li><a href="/index.html">Welcome</a></li> |
| <li><a href="/download.cgi">Download</a></li> |
| <li><a href="/releases.html">Releases</a></li> |
| <li><a href="/announce-2022.html">Announcements</a></li> |
| <li><a href="http://www.apache.org/licenses/">License</a></li> |
| <li><a href="https://www.apache.org/foundation/thanks.html">Thanks!</a></li> |
| <li><a href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li> |
| </ul> |
| </li> |
| <li class="dropdown"> |
| <a data-toggle="dropdown" href="#" class="dropdown-toggle"> |
| Support<b class="caret"></b> |
| </a> |
| <ul class="dropdown-menu"> |
| <li><a href="/mail.html">User Mailing List</a></li> |
| <li><a href="https://issues.apache.org/jira/browse/WW">Issue Tracker</a></li> |
| <li><a href="/security.html">Reporting Security Issues</a></li> |
| <li class="divider"></li> |
| <li><a href="https://cwiki.apache.org/confluence/display/WW/Migration+Guide">Version Notes</a></li> |
| <li><a href="https://cwiki.apache.org/confluence/display/WW/Security+Bulletins">Security Bulletins</a></li> |
| <li class="divider"></li> |
| <li><a href="/maven/project-info.html">Maven Project Info</a></li> |
| <li><a href="/maven/struts2-core/dependencies.html">Struts Core Dependencies</a></li> |
| <li><a href="/maven/struts2-plugins/modules.html">Plugin Dependencies</a></li> |
| </ul> |
| </li> |
| <li class="dropdown"> |
| <a data-toggle="dropdown" href="#" class="dropdown-toggle"> |
| Documentation<b class="caret"></b> |
| </a> |
| <ul class="dropdown-menu"> |
| <li><a href="/birdseye.html">Birds Eye</a></li> |
| <li><a href="/primer.html">Key Technologies</a></li> |
| <li><a href="/kickstart.html">Kickstart FAQ</a></li> |
| <li><a href="https://cwiki.apache.org/confluence/display/WW/Home">Wiki</a></li> |
| <li class="divider"></li> |
| <li><a href="/getting-started/">Getting Started</a></li> |
| <li><a href="/security/">Security Guide</a></li> |
| <li><a href="/core-developers/">Core Developers Guide</a></li> |
| <li><a href="/tag-developers/">Tag Developers Guide</a></li> |
| <li><a href="/maven-archetypes/">Maven Archetypes</a></li> |
| <li><a href="/plugins/">Plugins</a></li> |
| <li><a href="/maven/struts2-core/apidocs/index.html">Struts Core API</a></li> |
| <li><a href="/tag-developers/tag-reference.html">Tag reference</a></li> |
| <li><a href="https://cwiki.apache.org/confluence/display/WW/FAQs">FAQs</a></li> |
| <li><a href="http://cwiki.apache.org/S2PLUGINS/home.html">Plugin registry</a></li> |
| </ul> |
| </li> |
| <li class="dropdown"> |
| <a data-toggle="dropdown" href="#" class="dropdown-toggle"> |
| Contributing<b class="caret"></b> |
| </a> |
| <ul class="dropdown-menu"> |
| <li><a href="/youatstruts.html">You at Struts</a></li> |
| <li><a href="/helping.html">How to Help FAQ</a></li> |
| <li><a href="/dev-mail.html">Development Lists</a></li> |
| <li class="divider"></li> |
| <li><a href="/submitting-patches.html">Submitting patches</a></li> |
| <li><a href="/builds.html">Source Code and Builds</a></li> |
| <li><a href="/coding-standards.html">Coding standards</a></li> |
| <li><a href="/contributors/">Contributors Guide</a></li> |
| <li class="divider"></li> |
| <li><a href="/release-guidelines.html">Release Guidelines</a></li> |
| <li><a href="/bylaws.html">PMC Charter</a></li> |
| <li><a href="/volunteers.html">Volunteers</a></li> |
| <li><a href="https://gitbox.apache.org/repos/asf?p=struts.git">Source Repository</a></li> |
| <li><a href="/updating-website.html">Updating the website</a></li> |
| </ul> |
| </li> |
| <li class="apache"><a href="http://www.apache.org/"><img src="/img/apache.png"></a></li> |
| </ul> |
| </div> |
| </div> |
| </div> |
| </nav> |
| </header> |
| |
| |
| <article class="container"> |
| <section class="col-md-12"> |
| <a class="edit-on-gh" href="https://github.com/apache/struts-site/edit/master/source/plugins/plugins.md" title="Edit this page on GitHub">Edit on GitHub</a> |
| |
| <a href="index.html" title="back to Plugins"><< back to Plugins</a> |
| |
| <h1 class="no_toc" id="plugins">Plugins</h1> |
| |
| <ul id="markdown-toc"> |
| <li><a href="#static-resources" id="markdown-toc-static-resources">Static resources</a></li> |
| <li><a href="#extension-points" id="markdown-toc-extension-points">Extension Points</a></li> |
| <li><a href="#plugin-examples" id="markdown-toc-plugin-examples">Plugin Examples</a> <ul> |
| <li><a href="#sitemesh-plugin" id="markdown-toc-sitemesh-plugin">Sitemesh plugin</a></li> |
| <li><a href="#tiles-plugin" id="markdown-toc-tiles-plugin">Tiles plugin</a></li> |
| </ul> |
| </li> |
| <li><a href="#plugin-registry" id="markdown-toc-plugin-registry">Plugin Registry</a></li> |
| </ul> |
| |
| <p>Struts 2 plugins contain classes and configuration that extend, replace, or add to existing Struts framework functionality. |
| A plugin can be installed by adding its JAR file to the application’s class path, in addition to the JAR files to fulfill |
| whatever dependencies the plugin itself may have. To configure the plugin, the JAR should contain a <code class="highlighter-rouge">struts-plugin.xml</code> |
| file, which follows the same format as an ordinary <code class="highlighter-rouge">struts.xml</code> file.</p> |
| |
| <p>Since a plugin can contain the <code class="highlighter-rouge">struts-plugin.xml</code> file, it has the ability to:</p> |
| |
| <ul> |
| <li> |
| <p>Define new packages with results, interceptors, and/or actions</p> |
| </li> |
| <li> |
| <p>Override framework constants</p> |
| </li> |
| <li> |
| <p>Introduce new extension point implementation classes</p> |
| </li> |
| </ul> |
| |
| <p>Many popular but optional features of the framework are distributed as plugins. An application can retain all the plugins |
| provided with the distribution, or just include the ones it uses. Plugins can be used to organize application code |
| or to distribute code to third-parties.</p> |
| |
| <p>Packages defined in a plugin can have parent packages that are defined in another plugin. Plugins may define |
| configuration elements with classes not contained in the plugin. Any classes not included in the plugin’s JAR must be |
| on the application’s classpath at runtime. As from Struts 2.3.5</p> |
| |
| <p>The framework loads its default configuration first, then any plugin configuration files found in others JARs |
| on the classpath, and finally the “bootstrap” <code class="highlighter-rouge">struts.xml</code>.</p> |
| |
| <ol> |
| <li><code class="highlighter-rouge">struts-default.xml</code> (bundled in the Core JAR)</li> |
| <li><code class="highlighter-rouge">struts-plugin.xml</code> (as many as can be found in other JARs)</li> |
| <li><code class="highlighter-rouge">struts.xml</code> (provided by your application)</li> |
| </ol> |
| |
| <p>Since the <code class="highlighter-rouge">struts.xml</code> file is always loaded last, it can make use of any resources provided by the plugins bundled |
| with the distribution, or any other plugins available to an application.</p> |
| |
| <h2 id="static-resources">Static resources</h2> |
| |
| <p>To include static resources in your plugins add them under “/static” in your jar. And include them in your page using |
| “/struts” as the path, like in the following example:</p> |
| |
| <pre><code class="language-ftl"><!-- Assuming /static/main.css is inside a plugin jar, to add it to the page: --> |
| |
| <@s.url value="/struts/main.css" var="css" /> |
| <link rel="stylesheet" type="text/css" href="%{#css}" /> |
| </code></pre> |
| |
| <p>Read also <a href="https://struts.apache.org/maven/struts2-core/apidocs/org/apache/struts2/dispatcher/StaticContentLoader">StaticContentLoader JavaDoc</a>.</p> |
| |
| <h2 id="extension-points">Extension Points</h2> |
| |
| <p>Extension points allow a plugin to override a key class in the Struts framework with an alternate implementation. |
| For example, a plugin could provide a new class to create Action classes or map requests to Actions.</p> |
| |
| <p>The following extension points are available in Struts 2:</p> |
| |
| <table> |
| <thead> |
| <tr> |
| <th>Property</th> |
| <th>Description</th> |
| <th>Scope</th> |
| <th>Type</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td>struts.objectFactory</td> |
| <td>Creates actions, results, and interceptors</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.ObjectFactory</td> |
| </tr> |
| <tr> |
| <td>struts.objectFactory.actionFactory</td> |
| <td>Dedicated factory used to create Actions, you can implement/extend existing one instead of defining new ObjectFactory</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.factory.ActionFactory</td> |
| </tr> |
| <tr> |
| <td>struts.objectFactory.resultFactory</td> |
| <td>Dedicated factory used to create Results, you can implement/extend existing one instead of defining new ObjectFactory</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.factory.ResultFactory</td> |
| </tr> |
| <tr> |
| <td>struts.objectFactory.interceptorFactory</td> |
| <td>Dedicated factory used to create Interceptors, you can implement/extend existing one instead of defining new ObjectFactory</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.factory.InterceptorFactory</td> |
| </tr> |
| <tr> |
| <td>struts.objectFactory.converterFactory</td> |
| <td>Dedicated factory used to create TypeConverters, you can implement/extend existing one instead of defining new ObjectFactory</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.factory.ConverterFactory</td> |
| </tr> |
| <tr> |
| <td>struts.objectFactory.validatorFactory</td> |
| <td>Dedicated factory used to create Validators, you can implement/extend existing one instead of defining new ObjectFactory</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.factory.ValidatorFactory</td> |
| </tr> |
| <tr> |
| <td>struts.actionProxyFactory</td> |
| <td>Creates the ActionProxy</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.ActionProxyFactory</td> |
| </tr> |
| <tr> |
| <td>struts.objectTypeDeterminer</td> |
| <td>Determines what the key and element class of a Map or Collection should be</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.util.ObjectTypeDeterminer</td> |
| </tr> |
| <tr> |
| <td>struts.mapper.class</td> |
| <td>Determines the ActionMapping from a request and a URI from an ActionMapping</td> |
| <td>singleton</td> |
| <td>org.apache.struts2.dispatcher.mapper.ActionMapper</td> |
| </tr> |
| <tr> |
| <td>struts.multipart.parser</td> |
| <td>Parses a multipart request (file upload)</td> |
| <td>per request</td> |
| <td>org.apache.struts2.dispatcher.multipart.MultiPartRequest</td> |
| </tr> |
| <tr> |
| <td>struts.freemarker.manager.classname</td> |
| <td>Loads and processes Freemarker templates</td> |
| <td>singleton</td> |
| <td>org.apache.struts2.views.freemarker.FreemarkerManager</td> |
| </tr> |
| <tr> |
| <td>struts.velocity.manager.classname</td> |
| <td>Loads and processes Velocity templates</td> |
| <td>singleton</td> |
| <td>org.apache.struts2.views.velocity.VelocityManager</td> |
| </tr> |
| <tr> |
| <td>struts.actionValidatorManager</td> |
| <td>Main interface for validation managers (regular and annotation based). Handles both the loading of configuration and the actual validation (since 2.1)</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.validator.ActionValidatorManager</td> |
| </tr> |
| <tr> |
| <td>struts.valueStackFactory</td> |
| <td>Creates value stacks (since 2.1)</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.util.ValueStackFactory</td> |
| </tr> |
| <tr> |
| <td>struts.reflectionProvider</td> |
| <td>Provides reflection services, key place to plug in a custom expression language (since 2.1)</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.reflection.ReflectionProvider</td> |
| </tr> |
| <tr> |
| <td>struts.reflectionContextFactory</td> |
| <td>Creates reflection context maps used for reflection and expression language operations (since 2.1)</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.reflection.ReflectionContextFactory</td> |
| </tr> |
| <tr> |
| <td>N/A</td> |
| <td>All beans registered as PackageProvider implementations will be automatically included in configuration building (since 2.1)</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.config.PackageProvider</td> |
| </tr> |
| <tr> |
| <td>struts.patternMatcher</td> |
| <td>Matches patterns, such as action names, generally used in configuration (since 2.1)</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.util.PatternMatcher</td> |
| </tr> |
| <tr> |
| <td>struts.staticContentLoader</td> |
| <td>Loads static resources (since 2.1)</td> |
| <td>singleton</td> |
| <td>org.apache.struts2.views.dispatcher.DefaultStaticContentLoader</td> |
| </tr> |
| <tr> |
| <td>struts.xworkConverter</td> |
| <td>Handles conversion logic and allows to load custom converters per class or per action</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.conversion.impl.XWorkConverter</td> |
| </tr> |
| <tr> |
| <td>struts.localeProviderFactory</td> |
| <td>Allows provide custom LocaleProvider for whole application</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.LocaleProviderFactory</td> |
| </tr> |
| <tr> |
| <td>struts.urlRenderer</td> |
| <td>Allows provide custom implementation of environment specific URL rendering/creating class</td> |
| <td>singleton</td> |
| <td>org.apache.struts2.components.UrlRenderer</td> |
| </tr> |
| <tr> |
| <td>struts.unknownHandlerManager</td> |
| <td>Implementation of this interface allows handle logic of unknown Actions, Methods or Results</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.UnknownHandlerManager</td> |
| </tr> |
| <tr> |
| <td>struts.view.urlHelper</td> |
| <td>Helper class used with URLRenderer to provide exact logic for building URLs</td> |
| <td>singleton</td> |
| <td>org.apache.struts2.views.util.UrlHelper</td> |
| </tr> |
| <tr> |
| <td>struts.fileManagerFactory</td> |
| <td>Used to create FileManager instance to access files on the File System as also to monitor if reload is needed, can be implemented / overwritten to meet specific an application server needs</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.FileManagerFactory</td> |
| </tr> |
| <tr> |
| <td>struts.converter.collection</td> |
| <td>Converter used to convert any object to Collection and back</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.conversion.impl.CollectionConverter</td> |
| </tr> |
| <tr> |
| <td>struts.converter.array</td> |
| <td>Converter used to convert any object to Array and back</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.conversion.impl.ArrayConverter</td> |
| </tr> |
| <tr> |
| <td>struts.converter.date</td> |
| <td>Converter used to convert any object to Date and back</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.conversion.impl.DateConverter</td> |
| </tr> |
| <tr> |
| <td>struts.converter.number</td> |
| <td>Converter used to convert any object to Number and back</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.conversion.impl.NumberConverter</td> |
| </tr> |
| <tr> |
| <td>struts.converter.string</td> |
| <td>Converter used to convert any object to String and back</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.conversion.impl.StringConverter</td> |
| </tr> |
| <tr> |
| <td>struts.conversion.properties.processor</td> |
| <td>Process Properties to create converters</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.conversion.ConversionPropertiesProcessor</td> |
| </tr> |
| <tr> |
| <td>struts.converter.file.processor</td> |
| <td>Process {class}-conversion.properties file create converters</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.conversion.ConversionPropertiesProcessor</td> |
| </tr> |
| <tr> |
| <td>struts.converter.annotation.processor</td> |
| <td>Process TypeConversion annotation to create converters</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.conversion.ConversionAnnotationProcessor</td> |
| </tr> |
| <tr> |
| <td>struts.converter.creator</td> |
| <td>Creates user converters</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.conversion.TypeConverterCreator</td> |
| </tr> |
| <tr> |
| <td>struts.converter.holder</td> |
| <td>Holds user converters’ instances</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.conversion.TypeConverterHolder</td> |
| </tr> |
| <tr> |
| <td>struts.expression.parser</td> |
| <td>Used to parse expressions like ${foo.bar} or %{bar.foo} but it is up tp the TextParser’s implementation what kind of opening char to use (#, $, %, etc)</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.util.TextParser</td> |
| </tr> |
| <tr> |
| <td>struts.excludedPatterns.checker</td> |
| <td>Used across different interceptors to check if given string matches one of the excluded patterns</td> |
| <td>request</td> |
| <td>com.opensymphony.xwork2.ExcludedPatternsChecker</td> |
| </tr> |
| <tr> |
| <td>struts.acceptedPatterns.checker</td> |
| <td>Used across different interceptors to check if given string matches one of the accepted patterns</td> |
| <td>request</td> |
| <td>com.opensymphony.xwork2.AcceptedPatternsChecker</td> |
| </tr> |
| <tr> |
| <td>struts.contentTypeMatcher</td> |
| <td>Matches content type of uploaded files (since 2.3.22)</td> |
| <td>singleton</td> |
| <td>org.apache.struts2.util.ContentTypeMatcher</td> |
| </tr> |
| <tr> |
| <td>struts.localizedTextProvider</td> |
| <td>Provides access to resource bundles used to localise messages (since 2.5.11)</td> |
| <td>singleton</td> |
| <td>com.opensymphony.xwork2.LocalizedTextProvider</td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="plugin-examples">Plugin Examples</h2> |
| |
| <p>Let’s look at two similar but different plugins bundled with the core distribution.</p> |
| |
| <h3 id="sitemesh-plugin">Sitemesh plugin</h3> |
| |
| <p><a href="http://opensymphony.com/sitemesh/">SiteMesh</a> is a popular alternative to Tiles. SiteMesh provides a common look-and-feel |
| to an application’s pages by automatically wrapping a plain page with common elements like headers and menubars.</p> |
| |
| <p>The <code class="highlighter-rouge">sitemesh-plugin.jar</code> contains several classes, a standard JAR manifest, and a plugin configuration file.</p> |
| |
| <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code> + META-INF/ |
| + manifest.mf |
| + org |
| + apache |
| + struts2 |
| + sitemesh |
| + FreeMarkerPageFilter.class |
| + TemplatePageFilter.class |
| + VelocityPageFilter.class |
| + struts-plugin.xml |
| </code></pre></div></div> |
| |
| <p>While the SiteMesh Plugin doesn’t provide any new results, interceptors, or actions, or even extend any Struts integration |
| points, it does need to know what settings have been enabled in the Struts framework. Therefore, its <code class="highlighter-rouge">struts-plugin.xml</code> looks like this:</p> |
| |
| <div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp"><?xml version="1.0" encoding="UTF-8" ?></span> |
| <span class="c"><!-- |
| /* |
| * $Id$ |
| * |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, |
| * software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| * KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations |
| * under the License. |
| */ |
| --></span> |
| <span class="cp"><!DOCTYPE struts PUBLIC |
| "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" |
| "http://struts.apache.org/dtds/struts-2.5.dtd"></span> |
| |
| <span class="nt"><struts></span> |
| <span class="nt"><bean</span> <span class="na">class=</span><span class="s">"org.apache.struts2.sitemesh.FreemarkerPageFilter"</span> <span class="na">static=</span><span class="s">"true"</span> <span class="na">optional=</span><span class="s">"true"</span><span class="nt">/></span> |
| <span class="nt"><bean</span> <span class="na">class=</span><span class="s">"org.apache.struts2.sitemesh.VelocityPageFilter"</span> <span class="na">static=</span><span class="s">"true"</span> <span class="na">optional=</span><span class="s">"true"</span><span class="nt">/></span> |
| <span class="nt"></struts></span> |
| |
| </code></pre></div></div> |
| |
| <p>The two bean elements, with the “static” flag enabled, tell Struts to inject the current settings and framework objects |
| into static property setters on startup. This allows, for example, the FreeMarkerPageFilter class to get an instance |
| of the Struts FreemarkerManager and the current encoding setting.</p> |
| |
| <h3 id="tiles-plugin">Tiles plugin</h3> |
| |
| <p><a href="http://struts.apache.org/struts-sandbox/tiles/index">Tiles</a> is a popular alternative to SiteMesh. Tiles provides |
| a common look-and-feel to an application’s pages by breaking the page down into common fragments or “tiles”.</p> |
| |
| <p>The <code class="highlighter-rouge">tiles-plugin.jar</code> contains several classes, a standard JAR manifest, and a configuration file.</p> |
| |
| <div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code> + META-INF/ |
| + manifest.mf |
| + org |
| + apache |
| + struts2 |
| + tiles |
| + StrutsTilesListener.class |
| + StrutsTileUtilImpl.class |
| + views |
| + tiles |
| + TilesResult.class |
| + struts-plugin.xml |
| </code></pre></div></div> |
| |
| <p>Since the Tiles Plugin does need to register configuration elements, a result class, it provides a <code class="highlighter-rouge">struts-plugin.xml</code> file.</p> |
| |
| <h2 id="plugin-registry">Plugin Registry</h2> |
| |
| <blockquote> |
| <p>For a list of bundled plugins, see the <a href="index">Plugin Reference Documentation</a>. For more about bundled and third-party |
| plugins, visit the <a href="http://cwiki.apache.org/S2PLUGINS/home">Apache Struts Plugin Registry</a>.</p> |
| </blockquote> |
| |
| </section> |
| </article> |
| |
| |
| <footer class="container"> |
| <div class="col-md-12"> |
| Copyright © 2000-2021 <a href="http://www.apache.org/">The Apache Software Foundation </a>. |
| All Rights Reserved. |
| </div> |
| <div class="col-md-12"> |
| Apache Struts, Struts, Apache, the Apache feather logo, and the Apache Struts project logos are |
| trademarks of The Apache Software Foundation. |
| </div> |
| <div class="col-md-12">Logo and website design donated by <a href="https://softwaremill.com/">SoftwareMill</a>.</div> |
| </footer> |
| |
| <script>!function (d, s, id) { |
| var js, fjs = d.getElementsByTagName(s)[0]; |
| if (!d.getElementById(id)) { |
| js = d.createElement(s); |
| js.id = id; |
| js.src = "//platform.twitter.com/widgets.js"; |
| fjs.parentNode.insertBefore(js, fjs); |
| } |
| }(document, "script", "twitter-wjs");</script> |
| <script src="https://apis.google.com/js/platform.js" async="async" defer="defer"></script> |
| |
| <div id="fb-root"></div> |
| |
| <script>(function (d, s, id) { |
| var js, fjs = d.getElementsByTagName(s)[0]; |
| if (d.getElementById(id)) return; |
| js = d.createElement(s); |
| js.id = id; |
| js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1"; |
| fjs.parentNode.insertBefore(js, fjs); |
| }(document, 'script', 'facebook-jssdk'));</script> |
| |
| |
| </body> |
| </html> |