You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by otisg <ot...@ureach.com> on 2002/12/24 19:03:02 UTC

(solved) Re: Re: Can't map HTML form action to Struts action

For those who see this error in the future:

This turned out to be a problem with
slightly invalid XML in struts-config.xml,
not web.xml, as the error may lead you to
believe.
The tool that helped me figure this out was
James Holmes' Struts Console application. 
Nice work, thanks.

Otis


---- On Tue, 24 Dec 2002, otisg
(otisg@ureach.com) wrote:

> Hello,
> 
> I see.  I thought
>
org.apache.velocity.tools.view.servlet.VelocityViewServlet
> replaces Struts' ActionServlet.  However, it
> seems that it is not an alternative Action
> Servlet for use with Velocity, as I thought,
> but rather an additional servlet capable of
> dealing with Velocity templates, and not
> with action mappings and such.
> 
> I still have a slight problem:
> 
> [2002/12/24 09:26:18] init exception for
> `action'
> javax.servlet.UnavailableException: Parsing
> error processing resource path
>         at
>
org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:931)
>         at
>
org.apache.struts.action.ActionServlet.init(ActionServlet.java:454)
> 
> That 'action' must be referring to this part
> from web.xml:
> 
>     <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>
>         <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>
> 
> 
> Am I doing something wrong?  This is a
> copied from one of the Struts examples.
> It looks fine to me...
> 
> Thanks,
> Otis
> 
> 
> 
> ---- On Tue, 24 Dec 2002, Jitendra Singh
> (jits_1998@hotmail.com) wrote:
> 
> > hi!
> > I am not sure if this is the correct way
> to call an action from HTML ..
> > if we want to call it as form action ..
> then we should give full path like
> > "/foo/login.do" .....
> > try and enlighten me too :-)
> > cheers!
> > Jitendra
> > ----- Original Message -----
> > From: "otisg" <ot...@ureach.com>
> > To: <st...@jakarta.apache.org>
> > Sent: Tuesday, December 24, 2002 10:51 AM
> > Subject: Can't map HTML form action to
> Struts action
> > 
> > 
> > > Hello,
> > >
> > > I am having difficulties hooking up an
HTML
> > > form action to an action mapping
defined in
> > > struts-config.xml.  This is the Struts
HEAD
> > > from CVS.  I am using Struts with
Velocity.
> > >  I can get .vm templates to load, but
can't
> > > get things like HTML form submission
action
> > > to map to a Struts action.
> > >
> > > My web.xml contains:
> > >
> > >     <servlet>
> > >
> > >
>
<servlet-name>MyVelocityViewServlet</servlet-name>
> > >
> > >
> >
>
<servlet-class>org.apache.velocity.tools.view.servlet.VelocityViewServlet</s
> > ervlet-class>
> > >         ...
> > >
> > >     <!-- Map *.vm files to Velocity -->
> > >     <servlet-mapping>
> > >
> > >
>
<servlet-name>MyVelocityViewServlet</servlet-name>
> > >         <url-pattern>*.vm</url-pattern>
> > >     </servlet-mapping>
> > >
> > >
> > > My struts-config.xml contains:
> > >
> > >     <action-mappings>
> > > <action type
> > > ="foo.bar.webapp.actions.LoginAction"
> > > name     ="loginF"
> > > validate ="true"
> > >                 path     ="/login"
> > > scope    ="request"
> > >                 input    ="/login.vm">
> > >     <forward name="success"  
> path="/home.vm"/>
> > >     <forward name="failure"
> > > path="/login.vm"/>
> > > </action>
> > >     </action-mappings>
> > >
> > >
> > > My HTML form contains this:
> > >
> > > <form method="POST" action="/foo/login">
> > >
> > > When I submit this form I get a 404
from the
> > > servlet container:
> > >
> > > 404 Not Found
> > > /foo/login was not found on this server.
> > >
> > > I've looked at several configuration
> > > examples, and what I have looks fine, but
> > > unfortunately it is not.  I am using this
> > > with Resin 2.1.6.  One suspicious
thing that
> > > I notice in Resin's log after I submit the
> > > HTML form is this:
> > >
> > > [2002/12/24 00:05:24] file: init
> > > [2002/12/24 00:05:24]
> > > com.caucho.server.http.DirectoryServlet:
> init
> > >
> > > This looks as if Resin is not mapping my
> > > /foo/action to the action servlet
defined in
> > > my web app's web.xml...maybe, not sure.
> > >
> > > I have tried mapping /foo/* to
> > > MyVelocityViewServlet in web.xml, but that
> > > resulted in .vm pages being rendered as
> > > text/plain.  That may be fixed by
> > > associating .vm extension with text/html,
> > > but I'm not sure how to do this under
Resin
> > > yet.  But I think I have something else
> > > wrong, anyway.
> > >
> > > Thank you,
> > > Otis
> > >
> > >
> > >
>
________________________________________________
> > > Get your own "800" number
> > > Voicemail, fax, email, and a lot more
> > > http://www.ureach.com/reg/tag
> > >
> > > --
> > > To unsubscribe, e-mail:
> >
>
<ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> > >
> > 
> > 
> 
> 
>
________________________________________________
> Get your own "800" number
> Voicemail, fax, email, and a lot more
> http://www.ureach.com/reg/tag
> 
> --
> To unsubscribe, e-mail:  
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
> 
> 
> 


________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag

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