Hi, you've reached the website of Mark Menard, Freemason, developer, businessman, photographer, motorcyclist and all around nice guy.
The main joy in my life is Sylva, my loving partner and friend. (You will see plenty of pictures of her. Also check out our site.) My professonal career is running a consulting firm concentrating on business automation and custom software. I enjoy software development, motorcycles, photography, dancing, freemasonry and travel.
Here you will find galleries of my latest photos, thoughts on software development, freemasonry, the occassional politics, and other things. Enjoy your time here.
Mark
An ongoing photographic study of Freemasonry.
To contact Mark send an email to mark@mjm.net. You will receive an auto response from my mail server to verify you're not a spammer.
© Mark Menard 2002-2007
Thanks a lot! So i have a
Thanks a lot!
So i have a new version of the interceptor-method:
public String intercept (ActionInvocation invocation) throws Exception { //get the session Map attributes = invocation.getInvocationContext().getSession(); // Is there a "user" object stored in the user's HttpSession? Object user = attributes.get(USER_HANDLE); if (user == null) { // The user has not logged in yet. // Is the user attempting to log in right now? Map parameters = invocation.getInvocationContext().getParameters() String loginAttempt = parameters.get( LOGIN_ATTEMPT); if (! StringUtils.isBlank (loginAttempt) ) { // The user is attempting to log in. // Process the user's login attempt. if (processLoginAttempt (request, session) ) { // The login succeeded send them the login-success page. return "login-success"; } else { // The login failed. Set an error if we can on the action. Object action = invocation.getAction (); if (action instanceof ValidationAware) { ((ValidationAware) action).addActionError ("Username or password incorrect."); } } } //put the address of the action called originally into the session String urlGoingTo = invocation.getProxy().getNamespace()+"/"+ invocation.getProxy().getActionName()+".action"; attributes.put( "GOING_TO", urlGoingTo); // Either the login attempt failed or the user hasn't tried to login yet, // and we need to send the login form. return "login"; } else { return invocation.invoke (); } }It's a little nicer looking because it gets maps of the parameters and session-attributes instead of using the more clumpsy HttpSession/HttpServletRequest-classes.
The url is saved into the session (GOING_TO) and can be used in the login.jsp to redirect to where the user wanted to go originally.