It's a nice link but I don't thiunk it answers the question.
When the user requests a secured resource, the container detects this. It the remembers the original page and sends you to the specified login page. After successfully logging in, the container looks at the original request and sends the user there. This should come as no surprise to you so far.
The part you're looking for is where the container remembers the original request and then uses this value later on once the user logs in. If you can find out how this works, you can piggy back the mechanism for your own use.
Unfortunately I don't have anything available to
test this myself, but there are limitted places the information can be stored, so I would start like this:
Define your login page as login.jsp and register this with Tomcat. Add extra code in the
JSP to look at all of the cookies and Session values and dump them to the page. As long as you find the information you're looking for, you can then look at ways to set this value yourself when a user logs in and does not already have a redirect location defined.
This is still not quite answer, since you may not be able to define at that stage exactly which 'user home'
you should be sending to. One solution to detect the forward location, if this location is not set or not valid (due to security reasons) set it to some default secured location, such as /users/index.jsp
Once the user has logged in and finally gets to this page, you now have all the information you need to find their user name, find their home location and do a sendRedirect() to the correct location.
Hope this helps. I haven't done this before although I've considered it several times. Tell me how you get along.
Dave.