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" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> 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: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

