you have to implement interceptor for that,check this works out for you?
public class LoginInterceptor extends AbstractInterceptor {
private static final
String USER = "user";
public String intercept (ActionInvocation invocation) throws Exception {
// Get the action context from the invocation so we can access the
// HttpServletRequest and HttpSession objects.
final ActionContext context = invocation.getInvocationContext ();
HttpServletRequest request = (HttpServletRequest) context.get(HTTP_REQUEST);
HttpSession session = request.getSession (true);
Object user = session.getAttribute (USER);
if (user != null) {
// The user already logged in..
return invocation.invoke (); // send to other interceptor/other page
} else {
return "login"; // if login failed/invalid user redirecting to login page(configure in struts.xml file)
}
}
}