Child pages
  • Package Configuration
Skip to end of metadata
Go to start of metadata

Packages are a way to group actions, results, result types, interceptors, and interceptor-stacks into a logical configuration unit. Conceptually, packages are similiar to objects in that they can be extended and have individual parts that can be overridden by "sub" packages.

Packages

The package element has one required attribute, name, which acts as the key for later reference to the package. The extends attribute is optional and allows one package to inherit the configuration of one or more previous packages - including all interceptor, interceptor-stack, and action configurations.

(warning) Note that the configuration file is processed sequentially down the document, so the package referenced by an "extends" should be defined above the package which extends it.

The optional abstract attribute creates a base package that can omit the action configuration.

Attribute

Required

Description

name

yes

key to for other packages to reference

extends

no

inherits package behavior of the package it extends

namespace

no

see Namespace Configuration

abstract

no

declares package to be abstract (no action configurations required in package)

Simple usage

Package Example (struts.xml)

Inherit from more than one package

Multi package Example (struts.xml)

3 Comments

  1. extends="default" should probably be extends="default" in the example.

  2. I meant "should probably be extends="struts-default"".

    1. This appears to have been fixed; thanks for the feedback.