Dear All,

I'm trying to use exceptions to make sure a user is logged in, using
struts 2.1.6. My idea is

    * a subclass of ActionSupport that checks that a user is logged
      in, and throws a NotLoggedInException if that's not the case

    * all other action handlers are subclasses of that subclass

    * use a global exception mapping to map the NotLoggedInException
      to a suitable login action

I can't seem to get this to work, I get a 500 response with a stack
trace, saying "Unable to instantiate Action". If I arrange for the
constructor to complete without an exception and for the execute()
method to throw a NotLoggedInException, I get to the login action as
I intend.

So it seems that only exceptions thrown by execute(), but not those
thrown by constructors, are handled as specified by the exception
mappings (at least the global ones) -- is that right? And if so, why
is that?

Or do you thing I've just made some silly mistake here?

Best regards, Jan
-- 
 +- Jan T. Kim -------------------------------------------------------+
 |             email: j....@uea.ac.uk                                 |
 |             WWW:   http://www.cmp.uea.ac.uk/people/jtk             |
 *-----=<  hierarchical systems are for files, not for humans  >=-----*

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to