Java - No action instance for path /loginUsuario could be

   
Vista:

No action instance for path /loginUsuario could be

Publicado por Miguel Angel Martin (1 intervención) el 11/11/2008 23:31:43
Hola estoy montando un ejemplo de struts, me gustaría saber si alguien me puede ayudar con este problema,ya que por más vueltas que le doy no consigo ver el error, el problema me surge al pulsar el botón submit del formulario de ejemplo:

Error Otenido:
type Status report
message No action instance for path /loginUsuario could be created
description The server encountered an internal error (No action instance for path /loginUsuario could be created) that prevented it from fulfilling this request.

El código que tengo es el siguiente:
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/dtd/web-app_2_3.dtd">
<web-app>
<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>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<init-param>
<param-name>validating</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

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

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

<!-- Template Tag Library Descriptor -->
<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-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>

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

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

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

</web-app>
---------------------------------------------------------------------------
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="loginForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="userName" type="java.lang.String"></form-property>
<form-property name="password" type="java.lang.String"></form-property>
</form-bean>
</form-beans>

<action-mappings>

<action
path="/loginUsuario"
type="adasa.actions.LoginAction"
scope="request"
name="loginForm"
validate="true"
input="/jsp/index.jsp">
<forward name="Success" path="/jsp/menu.jsp" redirect="true"/>
<forward name="Failure" path="/jsp/error.jsp" redirect="false"/>
</action>

</action-mappings>

</struts-config>
---------------------------------------------------------------------------
Index.jsp

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html >
<head >
<title >login Page </title >
</head >
<body >
<html:form action="loginUsuario.do" method="post" >
<h1 >Login </h1 >
<table >
<tr >
<td >User Name </td >
<td > <html:text property="userName"/></td >
</tr >
<tr >
<td >Password </td >
<td > <html:password property="password"/></td >
</tr >
<tr >
<td > </td >
<td > <html:submit value="Log in"/> </td >
</tr >
</table >
</html:form >
<a href="/wica/loginUsuario.do?userName='pp'&password='pp'">Hola</a>
</body >
</html >
---------------------------------------------------------------------------
LoginAction

/**
*
*/
package adasa.actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;

public class LoginAction extends Action {
private final static String SUCCESS = "success";
private final static String FAILURE = "failure";

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {

String userName=request.getParameter("userName");
String password=request.getParameter("password");
if(userName.equals("guest")&&password.equals("guest")){
return mapping.findForward(SUCCESS);
}else{
return mapping.findForward(FAILURE);
}
}
}

Muchas gracias por todo.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder