How to use Struts2 convention without using any action class

In Struts2, we can define an action without using an action class in the struts.xml

following way:

<action name="error">
    <result>/error.jsp</result>
</action>

      

In my application, I am using struts2 convention

. In this case, how to avoid writing action classes. I have many scenarios where I just want to navigate to a page without using any business logic.

My path to results is not just JSP. I am using tiles. I am using the code like this:

@Action(value="homePage", results={@Result(name="success", location="homePage", type="tiles")})

      

+3


source to share


1 answer


You can put jsp in WEB-INF/content

this default path. You can also change this using a constant struts.convention.result.path

. The Convention plugin creates configuration from all JSPs. So if you have a do-something.jsp

result in the path, you can use /do-something

the browser to revert that inaction.



0


source







All Articles