global results across different packages defined in struts configuration file

前端 未结 1 1462
日久生厌
日久生厌 2020-12-04 00:53

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 st

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-04 01:51

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

    
      ...
      
        /pages/error_page.jsp
      
      ...
    
    

    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")
    

    0 讨论(0)
提交回复
热议问题