This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a Struts web application that needs to have different Actions and views for different types of consumers (say, "user" and "admin"). Most resources are the same, but there are instances where there are differences (for example, there are distinct login pages). I need to be able to track a user through the application so that if they time out (session expires), they get routed back to the correct login page.
I tried configuring Struts 1.1 with multiple modules in web.xml, each handling a different url-pattern ("/users/*" and "/admin/*"). I specified differently-named Struts ActionServlets for each mapped url-pattern, each with a different Struts config.xml file. Yet I seem to get routed to one servlet consistently, regardless of whether I use "http://localhost/myApp/users/login" or "http://localhost/myApp/admin/login". I always end up with the view that's defined by the servlet that should only be handling "admin" requests, even when the request is for the "users" servlet.
Any idea why this may be happening? I am using Struts 1.1 on Tomcat 5.0.
I'm not sure I understand what is meant when you say I declared the same one for both mappings. I'm under the impression that my <servlet-mapping> tags specify different paths for different named servlets (although the two servlets are the same class, is that what you meant?):