Hi Toby, 

You can define an extra servlet definition with the same class but
different name to use in your second servlet mapping. Something like
this:


  <servlet>
    <servlet-name>actionOne</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>

  <servlet>
    <servlet-name>actionTwo</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>

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

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


I'm pretty sure this should solve your problem. 

Regards,

Dimitar
-----Original Message-----
From: Toby Saville [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 21, 2004 1:34 AM
To: [EMAIL PROTECTED]
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 <html:form> by
appending the suffix of the last servlet mapping to the end of the
form's action (usually the .do part).

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