You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ol...@airfrance.fr on 2002/07/11 17:40:38 UTC

WEB-INF/web.xml hardcoded in initServlet() [struts 1.0.2]

Hi !

I am using Struts 1.0.2 under Visual Age for Java 3.5.3 and Websphere Test
Environment ; the architecture is not fully J2EE. In particular, WTE does
not parse the WEB-INF/web.xml file but another file with a similar syntax
(xxx_app.webapp) : this is where it finds the mappings for the servlets
(*.jsp -> jasper ; *.do -> Struts for instance).
Unfortunately, the WEB-INF/web.xml file is hardcoded in the initServlet()
method of the ActionServlet class ; it seems that this method parses the
file to store the mapping of the current servlet. This code, in my
environment, fails, but since a catch Throwable is done, the process goes
on. But, the ServletMapping variable has not been valued.
So, my question is : though everything seems to be working all right, am I
to expect a problem because of this ? And, subsequently, why does the
controller servlet need to know the original mapping, since this topic is
handled by the servlet container ? Can I go on in this situation without
fearing a future problem ?

Thanks for any explanation.

Olivier Schmeltzer



----------------

Les donnees et renseignements contenus dans ce message sont personnels, confidentiels et secrets. Ce message est adresse a l'individu ou l'entite dont les coordonnees figurent ci-dessus. Si vous n'etes pas le bon destinataire, nous vous demandons de ne pas lire, copier, utiliser ou divulguer cette communication. Nous vous prions de notifier cette erreur a l'expediteur et d'effacer immediatement cette communication de votre systeme.

The information contained in this message is privileged, confidential, and protected from disclosure. This message is intended for the individual or entity adressed herein. If you are not the intended recipient, please do not read, copy, use or disclose this communication to others ;also please notify the sender by replying to this message, and then delete it from your system.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: WEB-INF/web.xml hardcoded in initServlet() [struts 1.0.2]

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

On Thu, 11 Jul 2002 olschmeltzer@airfrance.fr wrote:

> Date: Thu, 11 Jul 2002 17:40:38 +0200
> From: olschmeltzer@airfrance.fr
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Subject: WEB-INF/web.xml hardcoded in initServlet() [struts 1.0.2]
>
> Hi !
>
> I am using Struts 1.0.2 under Visual Age for Java 3.5.3 and Websphere Test
> Environment ; the architecture is not fully J2EE. In particular, WTE does
> not parse the WEB-INF/web.xml file but another file with a similar syntax
> (xxx_app.webapp) : this is where it finds the mappings for the servlets
> (*.jsp -> jasper ; *.do -> Struts for instance).
> Unfortunately, the WEB-INF/web.xml file is hardcoded in the initServlet()
> method of the ActionServlet class ; it seems that this method parses the
> file to store the mapping of the current servlet. This code, in my
> environment, fails, but since a catch Throwable is done, the process goes
> on. But, the ServletMapping variable has not been valued.
> So, my question is : though everything seems to be working all right, am I
> to expect a problem because of this ? And, subsequently, why does the
> controller servlet need to know the original mapping, since this topic is
> handled by the servlet container ? Can I go on in this situation without
> fearing a future problem ?
>

Struts needs to know which mapping is used so that it can construct an
appropriate URL for <html:form> links where you specify the action path
only in the "action" parameter.  For example, if your struts-config.xml
says:

  ...
  <action path="/foo" .../>
  ...

and your JSP says:

  <html:form action="/foo" ...>

then Struts needs to know what extension to add (if you do extension
mapping) or what path prefix to stick on the front (if you are using path
mapping).

Struts is designed to operate only in containers that are compliant with
the specifications.  I'm not really interested in making accomodiations
for things like this -- I would suggest that WTE be changed to use the
standard deployment descriptors.

In the mean time, can you just ensure that the mapping is defined in both
files?



> Thanks for any explanation.
>
> Olivier Schmeltzer
>

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>