1

I would like to create a global-results across different packages which are under different namespaces. Can I know the conventions that required to follow in struts config file?

Roman C
  • 49,761
  • 33
  • 66
  • 176
Laxmikanth Samudrala
  • 2,203
  • 5
  • 28
  • 45
  • It would be nice if you downvote a question to at least say what's wrong about it. – cljk Jul 20 '13 at 14:59
  • @cljk I don't understand your comment, I have *upvoted* this question, and recommend you do the same. – Roman C Jul 20 '13 at 17:17

1 Answers1

4

Define global result in the package that other packages extend. For example

<package name="default" extends="struts-default">
  ...
  <global-results>
    <result name="error">/pages/error_page.jsp</result>
  </global-results>
  ...
</package>

This result could be used across actions that forward to error page and as exception handling result.

If you are using conventions plugin with annotations you could define @Results annotation on the class that has the parent package other packages extend. For example

@Results({
  @Result(name = ERROR, location = "/pages/error_page.jsp"),
})

The parent package is annotated with @ParentPackage annotation. It could be placed on the class but better place it on the package. For example

package-info.java:

@ParentPackage("default")
Roman C
  • 49,761
  • 33
  • 66
  • 176