It sounds like you need to set executeResult=”true” for the action tag.

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thompson, Christopher C (Kris)
Sent: Monday, November 24, 2003 7:37 AM
To: [EMAIL PROTECTED]
Subject: [OS-webwork] ActionTag and interceptors

 

I am trying out the action tag as an alternative to executing my actions via the Dispatcher.  I really like this functionality that it provides however I am having one slight problem with it and how it works with interceptors.  Here is the problem, I have an interceptor which I created to check to see if the user has authenticated or not.  This interceptor is associated with every action that requires authentication.  One quick note, this all works great when I don’t use the action tag and go threw the Dispatcher instead.  The problem is that when I use the action tag and go to the page, ie, …../wafer/addStory.jsp and the user has not logged in  the interceptor is called and it recognizes that they need to log in so it return Action.LOGIN (as it should) however I never end up on the login page, it simple says on the addStory.jsp.

 

Is this even possible since I am going to an absolute file instead of a reference URL like addStory.do? 

 

Here is a snipet of the Interceptor code

 

protected void before(ActionInvocation invocation) throws Exception

      {

            User u = null;

            ActionContext ctx = ActionContext.getContext();

            Map session = ctx.getSession();

            u = (User)session.get("user");

           

            if(u == null)

            {

                  log.info("User not logged in");

                  loggedIn = false;

            }

            else

                  loggedIn = true;

      }

     

      protected void after(ActionInvocation invocation, String result) throws Exception

      {

            log.info("After");

      }

     

      public String intercept(ActionInvocation invocation) throws Exception {

           

            before(invocation);

            if(loggedIn == false)

                  return Action.LOGIN;

            else

            {

                  String result = invocation.invoke();

                  // we don't need to do this but here for explaination sake.

                  after(invocation, result);

                 

                  return result;

            }    

      }

}

 

Thanks

 

Kris Thompson

Reply via email to