You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Cook <Ja...@wecomm.com> on 2010/06/08 16:00:41 UTC

Struts.xml - Packages

Hi All,

 

Having a blank mind moment here. I was hoping someone might be able to
clear it up with me.

 

I am using my favourite Struts 2 setup of Convention + Spring. However I
am just going through the process of adding a global exception mapping,
so I created a struts.xml file which contains the following:

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts PUBLIC

"-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"

"http://struts.apache.org/dtds/struts-2.1.dtd">

 

<struts>

    <package name="default" namespace="/" extends="convention-default">

        <global-results>

            <result name="timeout"
>/WEB-INF/jsp/error/timeout.jsp</result>

        </global-results>

        <global-exception-mappings>

            <exception-mapping
exception="com.me.exception.DataTimeoutException" result="timeout" />

        </global-exception-mappings>

    </package>

</struts>

 

I also set the following in my web.xml

 

<init-param>

<param-name>struts.convention.default.parent.package</param-name>

            <param-value>default</param-value>

</init-param>

 

Now for me here is where the confusion comes in. 

 

Struts Core has a default package which is abstract. This is overridden
with the convention plugin with a concrete version "convention-default"
(note, it is empty). However the Spring plugin also has its own package
"spring-default" which contains 2 interceptors for autowiring. 

 

Does this mean I am never using the Spring package as I never extend it
or have it as part of me configuration, I have always left the config to
"convention-default" and added the library for Spring which meant I
could do

 

@Autowired

MyService myService

 

In my action.

 

Or is the Spring package included somehow and I have missed it?

 

Please please someone help me from going insane... J

 

James