Toby,

Struts ActionServlet only allow configuration for one mapping.  From your
experiments, the last one in the web.xml sounds like it takes precedence and
resets internal ActionServlet settings for the latest mapping.  Think of it
this way: If you had two mappings, how would you make the html:form tag know
you wanted to use the '.tm' or '.usr' suffix (or a prefix for that matter
since I use /do/* as my mapping) ?  Struts html:form has no way for you to
specify that part of the form name since it was only built to handle the one
mapping.

If it is all one struts application, why would you need two suffix mappings
for the same Struts app?  You'd have to hand-code the html <form
action="..."> tag for what you're suggesting (two different suffixes for one
Struts webapp).

Regards,
David

-----Original Message-----
From: Toby Saville [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 22, 2004 6:03 PM
To: Struts Users Mailing List
Subject: Multiple Action Servlet Mappings


I have my action servlet mapped to 2 different url patterns (which are used
for filtering purposes elsewhere in my site). It seems the order of my
servlet mappings affects the action attribute of my form by appending of the
suffix of the last mapping to the end of the form's action.

As an example:

I have the following servlet definition:

  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

And the following mappings:

  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.tm</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.usr</url-pattern>
  </servlet-mapping>

And the following form definition in my JSP:

        <html:form action="order/item/add.tm">

When I load the jsp page with the above form definition and view the source,
the form definition ends up looking like this:

        <form name="addItemForm" method="post"
action="/website/gsp/order/item/add.usr">

If i swap the order of the mappings above so that the url-pattern *.tm is
second, then the form definition ends up being:

        <form name="addItemForm" method="post"
action="/website/gsp/order/item/add.tm">

Can anyone explain why this might be happening?

Thanks

Toby


***************************************************************
This message is intended for the addressee named and
may  contain confidential information. If you are not the
intended recipient, please delete it and notify the sender.
Views expressed in this message are those of the
individual sender, and are not necessarily the views of
the Department of  Lands.

This email message has been swept by MIMEsweeper
for the presence of computer viruses.
***************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to