Apache Struts 2: Redirecting to a link and another Action

Apache Struts is a project developing an open-source web application framework for Java EE web application development that promotes a model–view–controller (MVC) architectural approach through extensions the Java Servlet web API. [Definition from Wikipedia]

To know more about Apache Struts 2, click here.

Redirect To JSP Page

It is very simple to redirect to a JSP(JavaServer Pages) which is a technology that helps software developers create dynamically generated web pages based on HTML, XML, or other document types.

Redirect To Action

Assuming that you have an Action called LoginAction and HomeAction,

You can also pass parameters to an action while redirecting and call another Page if the input are not provided in the initial page like this.

Description:

If LoginAction returns “success” then go to “home” action (which calls HomeAction).

If input values are not properly provided to LoginAction and it returns “input” or “Action.INPUT”, then open login.jsp.

Lead Software Engineer