You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mindaugas Idzelis <ma...@ritvax.isc.rit.edu> on 2001/03/15 06:15:57 UTC

RE: not rendering action attribute properly (Found problem)

I found the problem. It was in my web.xml file. I had the following:

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

I guess when struts was looking up to see what to add to the end of the
servlets name there was a problem. (I guess it's looking to see which url
patterns match "action" and since I have two patterns it got confused and
outputed nothing.

Would this be considered a bug, or is there something wrong with my web.xml
file? What I was trying to accomplish was to have the action servlet handle
the initial request to the website. Thanks.

-----Original Message-----
From: Mindaugas Idzelis [mailto:mai3116@ritvax.isc.rit.edu]
Sent: Wednesday, March 14, 2001 10:45 PM
To: struts-user@jakarta.apache.org
Subject: RE: <html:form> not rendering action attribute properly


Yes, I am using the "struts-example" struts-config.xml file as my base
config file. I have the action servlet loaded on startup: (When I start the
servlet engine, i see all the debug messages fly buy) all the formBeans are
properly found. There is no output in the log file about any errors. There
are no exceptions.

Yes, the struts example works for me. I'm currently trying to compare as
much of my code to its code as possible.

--min




RE: not rendering action attribute properly (Found problem)

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

On Thu, 15 Mar 2001, Mindaugas Idzelis wrote:

> I found the problem. It was in my web.xml file. I had the following:
> 
>         <servlet-mapping>
>                 <servlet-name>action</servlet-name>
>                 <url-pattern>*.do</url-pattern>
> 		    <servlet-name>action</servlet-name>
> 		    <url-pattern>/mysite<url-pattern>
>         </servlet-mapping>
> 
> I guess when struts was looking up to see what to add to the end of the
> servlets name there was a problem. (I guess it's looking to see which url
> patterns match "action" and since I have two patterns it got confused and
> outputed nothing.
> 

You are correct in your thought that Struts looks at the <servlet-mapping>
to determine how to construct the submit URLs in <html:form>.  The problem
is that Struts would read the above and assume that the "*.do" pattern was
the correct one.  However, Tomcat 3.2.1 (at least) would parse that and
use the "/mysite" pattern (which you would really want to be
"/mysite/*") instead.

Running this on a servlet container that uses a validating XML parser to
read the web.xml file (such as Tomcat 4.0) would have caught this problem,
because it would have refused to load the web app in the first place.

> Would this be considered a bug, or is there something wrong with my web.xml
> file? What I was trying to accomplish was to have the action servlet handle
> the initial request to the website. Thanks.
> 

Well, you've got an invalid web.xml file all right.  The technical term
for what happens next is "undefined behavior".  :-)

Craig