You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Gamas Sugiarto <gs...@entertainmentpartners.com> on 2003/07/17 20:32:40 UTC

Servlet & Struts declaration in web.xml?

Hi,

Does anyone every had problem in declaring a simple servlet declaration &
mapping when struts framework is used?

I am using resin-2.1.8 and struts.

I declare a servlet called ProductUpdates with url-pattern
"/PAS2/servlet/ProductUpdates". However, when I try to access it in the web
browser I got "404 Not Found" error saying that
/PAS2/servlet/ProductUpdates" is not found in the server.

Any assistance would be greatly appreciated.

In my web.xml I included the following:
  <!-- Action Servlet Configuration -->
  <servlet>
   <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>application</param-name>
      <param-value>resources.application</param-value>
    </init-param>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>validate</param-name>
      <param-value>true</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>
<servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>

   <servlet>
         <servlet-name>ProductUpdates</servlet-name>

<servlet-class>com.epservices.apps.EPLicenser.servlet.ProductUpdates</servle
t-class>
      </servlet>
      <servlet-mapping>
          <servlet-name>ProductUpdates</servlet-name>
          <url-pattern>/PAS2/servlet/ProductUpdates</url-pattern>
      </servlet-mapping>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Servlet & Struts declaration in web.xml?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 17 Jul 2003, Gamas Sugiarto wrote:

> Date: Thu, 17 Jul 2003 11:32:40 -0700
> From: Gamas Sugiarto <gs...@entertainmentpartners.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>,
>      gsugiarto@entertainmentpartners.com
> To: Struts Users Mailing List <st...@jakarta.apache.org>
> Subject: Servlet & Struts declaration in web.xml?
>
> Hi,
>
> Does anyone every had problem in declaring a simple servlet declaration &
> mapping when struts framework is used?
>
> I am using resin-2.1.8 and struts.
>
> I declare a servlet called ProductUpdates with url-pattern
> "/PAS2/servlet/ProductUpdates". However, when I try to access it in the web
> browser I got "404 Not Found" error saying that
> /PAS2/servlet/ProductUpdates" is not found in the server.
>

Is "/PAS2" the context path you are deploying this app under?  If so, you
should *not* include it in any paths in web.xml (or struts-config.xml, for
that matter).  Servlet mappings should contain only the part of the URL
that is after the context path.

By the way, there's no reason you must include the "/servlet" part if you
don't want it -- the context-relative part of the URL can be whatever you
really want.

Craig

> Any assistance would be greatly appreciated.
>
> In my web.xml I included the following:
>   <!-- Action Servlet Configuration -->
>   <servlet>
>    <servlet-name>action</servlet-name>
>     <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
>     <init-param>
>       <param-name>application</param-name>
>       <param-value>resources.application</param-value>
>     </init-param>
>     <init-param>
>       <param-name>config</param-name>
>       <param-value>/WEB-INF/struts-config.xml</param-value>
>     </init-param>
>     <init-param>
>       <param-name>debug</param-name>
>       <param-value>2</param-value>
>     </init-param>
>     <init-param>
>       <param-name>detail</param-name>
>       <param-value>2</param-value>
>     </init-param>
>     <init-param>
>       <param-name>validate</param-name>
>       <param-value>true</param-value>
>     </init-param>
>     <load-on-startup>2</load-on-startup>
>   </servlet>
> <servlet-mapping>
>     <servlet-name>action</servlet-name>
>     <url-pattern>*.do</url-pattern>
>   </servlet-mapping>
>
>    <servlet>
>          <servlet-name>ProductUpdates</servlet-name>
>
> <servlet-class>com.epservices.apps.EPLicenser.servlet.ProductUpdates</servle
> t-class>
>       </servlet>
>       <servlet-mapping>
>           <servlet-name>ProductUpdates</servlet-name>
>           <url-pattern>/PAS2/servlet/ProductUpdates</url-pattern>
>       </servlet-mapping>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org