I working on a project from scratch using RAD7.5,struts2.1.6,spring and hibernate. I just started integrating all these and created login page. when i tried to access the loginaction i am getting the following error.
com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn Could not find action or result
No result defined for action gov.tx.hhsc.hraps.action.LoginAction and result success
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:363).....
Here are the configurations,
My web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>hrapsWeb</display-name>
<context-param>
<param-name>tilesDefinitions</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/struts/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>
org.apache.struts2.tiles.StrutsTilesListener
</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
MY Struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<constant name="struts.action.extension" value="action" />
<package name="gov" namespace="/hraps" extends="struts-default">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="login" class="hraps.LoginAction" >
<result type="tiles">tiles.login</result>
</action>
</package>
</struts>
Tiles.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<definition name="tiles.login" template="/base/Layout.jsp">
<put-attribute name="application" value="(HRAPS)"/>
<put-attribute name="header" value="/base/Header.jsp"/>
<put-attribute name="navigation" value=""/>
<put-attribute name="body" value="/base/Login.jsp"></put-attribute>
<put-attribute name="footer" value="/base/Footer.jsp"/>
</definition>
</tiles-definitions>
Action class
public class LoginAction extends BaseAction {
/**
*
*/
private static final long serialVersionUID = 1L;
public LoginAction() {
// TODO Auto-generated constructor stub
}
public
String execute() throws Exception {
System.out.println("In LoginAction execute method");
return SUCCESS;
}
}
Login.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><%@page
language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%@taglib uri="/struts-dojo-tags" prefix="sx"%>
<%@taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<html>
<head>
<title>Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<s:form name="frmLogin" action="login" theme="simple">
<div class="ContentRow">
</div>
<div class="ContentRow">
<div class="FieldLabel" style="width:22%">
<s:label value="Employee ID:" />
</div>
<div class="Field" style="width:38%" align="left">
<s:textfield name="user.employeeData.emplid" maxlength="25" size="25" required="true" />
</div>
</div>
<div class="ContentRow">
<div class="FieldLabel" style="width:22%">
<s:label name="password" value="Password:" />
</div>
<div class="Field" style="width:38%" align="left">
<s:password name="password" maxlength="25" size="25" required="true" />
</div>
</div>
<div class="displayButton">
<s:submit name="submit" value=" Submit " onclick="return validate();" />
<s:reset name="reset" value=" Reset " />
</div>
</s:form>
</body>
</html>
Can you please help me what is wrong in my files. I am struck here.
Thanks,
gang.