How do I make a redirectAction when using REST Plugin (Struts 2)

507 views Asked by At

Considering the typical case when, after creating, updating or deleting an element, you want to do a redirectAction to the "index" action (or whatever other action). ¿How do you make it if you are using the REST Plugin?

1

There are 1 answers

0
ontk On

In your action, you can do: return "index" and before declaring your class, you can use the Results annotation. For example:

@Results({
    @Result(name="create", location="/home", type="redirect")
}) 

or

@Results({
    @Result(name="success", type="redirectAction", params = {"actionName" , "orders"})
})

Hope it helps