On Fri, 22 Nov 2002, Nelson, Laird wrote:
> Date: Fri, 22 Nov 2002 12:18:16 -0500 > From: "Nelson, Laird" <[EMAIL PROTECTED]> > Reply-To: Struts Developers List <[EMAIL PROTECTED]> > To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> > Subject: servletMapping field in ActionServlet (1.0.2) > > Hi; I'm looking at the v1.0.2 ActionServlet's addServletMapping() method, > and I'm noticing that it only handles the case where the ActionServlet has > one servlet mapping associated with it. But it's legal (is it not?) to > establish several servlet mappings for a Servlet under the 2.2 spec, right? > It's definitely legal from the servlet spec perspective, but not from the Struts ActionServlet perspective. Struts currently does not know how to reliably compute URLs for things like <html:form> in the face of more than one mapping. > In our case, we have an ActionServlet that is currently set up to handle > several different paths. These paths are not really important to the > Actions per se, but (depending on various factors) may be important for > reporting purposes (i.e. did the person get into the website via path A, > path B or path C, even though all will route him to ActionA). The Form tag > seems to be the only Struts tag that uses the servletMapping attribute. > Because the addServletMapping() method only ever takes the last mapping it > finds, it will always look (if I'm reading the code right) like all requests > that make use of the Form tag were submitted to path C. > A subtle point needs to be remembered -- from the client viewpoint, the URL you *submit* to (i.e. the action) is what shows in the Location bar on a browser. Since the Action that is invoked can return an ActionForward to *any* page, the same URL can literally display anything. This applies to any scenario that uses RequestDispatcher.forward(), not just to Struts. More fundamentally, then, I would contend that the absolute value of a URL is totally meaningless in a web application based on an MVC architecture that uses RD.forward() the way Struts uses it. They are simply an internal implementation detail of the communication, and have no meaning in and of themselves. Web Applications != Web Sites > Is there a simple workaround for this, or should I look into submitting a > patch? Or should I just not worry about it? :-) There is not going to be a useful workaround for this -- it's fundamental to the nature of the architecture. > > Thanks kindly and happy Friday. > > Laird Craig -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
