This recipe covers a very simple concept in JIRA web actions. While writing plugins, we often come across scenarios where we need to navigate to a new page, such as a Dashboard, to browse a new project, or view another issue after the action has executed. JiraWebActionSupport
provides a simple method for doing this, which we will see in this recipe.
What if we want to navigate to the Dashboard instead of rendering a success view when an action is executed? What if we can't directly link it from the JSP page or the velocity template because we want to perform something in the action class beforehand?
All you need to do here is to return getRedirect(URL)
in the action class's doExecute
method (or the appropriate method)! This method will redirect to the specified location after the action method has successfully finished. If there are any errors, it will go to the error page, as the getRedirect()
method returns Action.ERROR
in...