Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9068017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:05:17+00:00 2026-06-16T17:05:17+00:00

below are my interceptors & global-results as defined in struts.xml <package name=auth_basic extends=struts-default,tiles-default> <interceptors>

  • 0

below are my interceptors & global-results as defined in struts.xml

 <package name="auth_basic" extends="struts-default,tiles-default">
<interceptors>
        <interceptor name="nlogin" class="interceptors.LoginInterceptor"/>
        <interceptor-stack name="loginStack">
            <interceptor-ref name="nlogin"/>
            <interceptor-ref name="defaultStack"/>
        </interceptor-stack>
    </interceptors>
    <default-interceptor-ref name="loginStack"/>
    <global-results>
        <result name="login" type="redirectAction">gotostart</result>
        <result name="input" type="redirectAction">gotostart</result>
    </global-results>
.
.
.
</package>

The above configuration works fine, but when I use result chain instead of redirectAction it gives java.lang.StackOverflowError

Also when I use tiles instead of chain, then also it throws java.lang.StackOverflowError

Can I not use action-chaining in global-results ?

Below is my interceptor code. Also, I would like to EMPHASIZE on the point that result type redirectAction is working fine, only tiles & chain are creating problems.

public String intercept(ActionInvocation ai) throws Exception {
    try {
        if (ai.getInvocationContext().getSession().get("user") == null) {
            System.out.println("Session Expired/Invalid");
            Object action = ai.getAction();
            if (action instanceof ValidationAware) {
                ((ValidationAware) action).addActionError("Unauthorized access. Please Login first");
            }
            return "login";
        }
        return ai.invoke();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return ai.invoke();
}

edited to include more code from struts.xml

 <package name="default" extends="struts-default,tiles-default,json-default">
    <default-action-ref name="gotostart"/>
    <global-results>
        <result name="input" type="tiles">tiles-home</result>
    </global-results>
<action name="gotostart" class="actions.IndexAction" method="start">
        <result name="success" type="tiles">tiles-home</result>
        <result name="input" type="tiles">tiles-home</result>
    </action>
</package>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T17:05:18+00:00Added an answer on June 16, 2026 at 5:05 pm

    Ok, got it.

    If not logged in, you are returning an global result, login, that is a chain result type, then a call to another action.

    The login result type is under the same Interceptor Stack containing the nLogin Interceptor.

    This means that when you try to chain your login result, you pass AGAIN inside your nLogin Interceptor, checking again if user is null, and returning login result, in and endless loop.

    You can:

    return a JSP instead of chaining to another Action, like this:

    <result name="login">myLogin.jsp</result>
    

    or move your global result login outside your custom Interceptor Stack scope (putting it under the default stack in a parent package, for example), like this:

    <struts>
       <package name="defaultPackage" extends="struts-default" >
    
          <default-interceptor-ref name="defaultStack"/>
    
          <global-results>
             <result name="login" type="chain">
                <param name="actionName">myLoginAction</param>
             </result>
          </global-results>
    
       </package>
    
       <package name="myLoginProtectedPackage" extends="defaultPackage">
    
          <interceptors>
             <interceptor name="nlogin" class="interceptors.LoginInterceptor"/>
             <interceptor-stack name="loginStack">
                <interceptor-ref name="nlogin"/>
                <interceptor-ref name="defaultStack"/>
             </interceptor-stack>
          </interceptors>
    
          <default-interceptor-ref name="loginStack"/>
    
          <global-results>
            <result name="input" type="chain">
                <param name="actionName">myLoginAction</param>
            </result>
          </global-results>    
    
          <action name="myLoginAction" class="...">
             <result>myLogin.jsp</result>             
          </action>
    
       </package>
    </struts>
    

    Don’t ask me why with redirectAction works… it should be the same, but probably is due to their different behavior.

    Please note that, according to the guide,

    As a rule, Action Chaining is not recommended. First explore other options, such as the Redirect After Post technique.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below am posting my jsp page. home.jsp <%@taglib uri=/WEB-INF/struts-bean.tld prefix=bean%> <%@taglib uri=/WEB-INF/struts-html.tld prefix=html %>
Below is the code for my player which will automatically generate a playlist.xml file
The following is a code snippet from a struts.xml file for Struts 2. If
Below is code to an inherited ComboBox. The issue is that the ComboBox is
Below is the code from internalRegister method of GCMRegistrar class static void internalRegister(Context context,
below is the code to download a txt file from internet approx 9000 lines
Below is my main activity file. I am stuck with the bottom area (commented
Below is the code from a plugin I use for sitemaps. I would like
Below is how my screen look like ********************************************************* * Welcome to Mysite * *
Below is my form. Using jQuery I load a <select> element based on value

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.