Title: Struts2: How do I tell my index.jsp to forward to a struts2 action?
Tags: java;web-applications;frameworks;struts2
Question: Oftentimes when I see an index.jsp on a web application it just forwards to another url like login.jsp such as 

```<jsp:forward page="login.jsp" /&gt;
```

When using struts2, I want a similar index.jsp but I want it to forward to an action. How do I do this?


Here is the accepted answer: You can use plain HTML if you want

Between your head tags use:

``` <META HTTP-EQUIV="Refresh" CONTENT="1;URL=Login.action"&gt;
```

This will redirect to myCOntext/Login.action

If Login is behind a name space you wil need to include that in the URL

Comment for this answer: Probably irrelevant for this case, but this is redirect, NOT forward.
Comment for this answer: Thank you alzoid. Never thought it would be that simple :)

Here is another answer: Scriplet:

```<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%&gt;

<%  
response.sendRedirect("/Project/namespace/Login.action");
%&gt; 
```

I use it with Struts2 and it works.

Comment for this answer: True. I do this now, but three years ago I was still using them :)
Comment for this answer: @Trick in struts2 scriplets should be avoid.
Comment for this answer: Thank you. This works, but I'm trying to avoid using scriptlets ;)

Here is another answer: Try this:

```<META HTTP-EQUIV="Refresh" CONTENT="0;URL=welcomeLink.action"&gt;
```

This is also a working one,

```<%  
response.sendRedirect("welcomeLink.action");
%&gt; 
```

But in my experience it will work only when it is in index page, or any other page which is loaded as first page.

If I put response.sendRedirect in any successor page it will not work Reffer this question

Comment for this answer: In index.jsp you need to add only this line. It will goes to your Struts.xml and find mappings for this action.
It will work

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 3, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 2.5', 'CreationDate': '2010:00:07/06/10', 'FavoriteCount': 1.0, 'PostTypeId': 1, 'Tags': '<java><web-applications><frameworks><struts2>', 'Title': 'Struts2: How do I tell my index.jsp to forward to a struts2 action?', 'ViewCount': 18773, 'id': 3186402, 'user_AboutMe': '', 'user_AccountId': 156361.0, 'user_DisplayName': 'avendael', 'user_Reputation': 2459.0, 'user_Views': 227.0, 'user_id': 373596.0}}