struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From otisg <ot...@ureach.com>
Subject Can't map HTML form action to Struts action
Date Tue, 24 Dec 2002 05:21:31 GMT
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</servlet-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:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message