You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Ke...@ubsw.com on 2002/04/08 11:53:35 UTC

Multiple Servlet mappings problem (Struts 1.0.1 --> 1.1)

Thought I'd report this, to dev, got a bit lost on struts-user.

As a side note, since struts-user is so high volume, are there any 
plans to split it into smaller lists? (though I'm not sure on what 
basis, perhaps newbie/advanced or  basic,tags,validation,population / 
tiles,multi-app,menus,other / tomcat,websphere,jrun problems..

Ken.

-----Original Message-----
From: Horn, Ken 
Sent: 05 April 2002 20:09
To: struts-user
Cc: Horn, Ken
Subject: BUG: Multiple Servlet mappings problem (Struts 1.0.1)



Not sure if this is considered a bug, it may be. Certainly the code 
needs a catch-all to fix it.

I was having trouble getting a <html:form> tag to work, the action in 
the generated html, was always ="". Having resorted to using 
<struts:form> which worked (them were days, struts, pre version 
numbers...), I finally put some debug code in html.FormTag.

The problem was, that servlet mapping, that the form tag looks up in 
the application context was not the one that should have been used. I 
have many mappings to the ActionServlet, one is *.do, while the rest 
grab certain specific URL's (legacy JSP's, which get forwardeed to 
actual JSP's having been through the controller for session checks and 
logging). The form tag was finding a specific mapping, which fails ALL 
the tests in getActionMappingURL() (I also have no context path) - 
resulting in action="".

Quick solution: add a catch all (and maybe a warning?) to just use the 
url provided.

(this diff is from the 1.0.1 source, though the latest in cvs has the 
same problem)

*** FormTag.java.orig   Fri Apr  5 19:03:05 2002
--- FormTag.java        Fri Apr  5 19:03:51 2002
***************
*** 721,726 ****
--- 721,728 ----
                  value.append(servletMapping.substring
                               (0, servletMapping.length() - 2));
                  value.append(actionMapping);
+             } else {
+                 value.append(action);
              }
              if (queryString != null)
                  value.append(queryString);

Real solution: erm don't know. I managed to fix this by placing the 
*.do mapping last in web.xml, though this does seem very hacky and not 
particularly stable.

Ken.