aspose file tools*
The moose likes Struts and the fly likes Cannot retrieve mapping for action /Login Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Cannot retrieve mapping for action /Login" Watch "Cannot retrieve mapping for action /Login" New topic
Author

Cannot retrieve mapping for action /Login

Saravanan Jothimani
Greenhorn

Joined: Feb 25, 2005
Posts: 26
Hi,
I am new to struts.
I am getting an errror as javax.servlet.ServletException: Cannot retrieve mapping for action /Login when I type http://localhost:8080/stuts/web/Login.jsp in address bar.


Please correct me.
Login.jsp

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html>
<HEAD>
<%@ page language="java"contentType="text/html;
charset=ISO-8859-1"pageEncoding="ISO-8859-1" %>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>Login.jsp</TITLE>
</HEAD>
<BODY>
<html:form action="/Login">

<H3>Login</H3>
<TABLE border="0">
<TBODY>
<TR>
<TH>User Name</TH>
<TD><html:text property='userName' value='' /></TD>
<TR>
<TR>
<TH>Password</TH>
<TD><html:text property='password' value='' /></TD>
</TR>
<TR>
<TD><html:submit property="submit" value="Submit" /></TD>
<TD><html:reset /></TD>
</TR>
</TBODY>
</TABLE>
</html:form>
</BODY>
</html:html>


struts-config.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean
name="uservalidationonelogin"
type="com.uservalidationone.login.LoginForm">
</form-bean>
</form-beans>

<action-mappings>
<action
path="/Login"
type="com.uservalidationone.login.LoginAction"
name="uservalidationonelogin">
</action>
</action-mappings>

</struts-config>


web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>uservalidationone</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>3</param-value>
</init-param>

<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>

<load-on-startup>0</load-on-startup>
</servlet>

<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>uservalidationone</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>jpg</extension>
<mime-type>image/jpeg</mime-type>
</mime-mapping>

<mime-mapping>
<extension>jpe</extension>
<mime-type>image/jpeg</mime-type>
</mime-mapping>

<mime-mapping>
<extension>jpeg</extension>
<mime-type>image/jpeg</mime-type>
</mime-mapping>

<mime-mapping>
<extension>gif</extension>
<mime-type>image/gif</mime-type>
</mime-mapping>


<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>Login.jsp</welcome-file>
</welcome-file-list>

<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
</web-app>

Thanks in Advance


Saravanan
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
<html:form action="/Login">

should be

<html:form action="Login">

the slash takes the action back to the SERVER root, not the application context root.


-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot retrieve mapping for action /Login