Why i am getting this error in my First struts2 application
Home.jsp :
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://ift.tt/kTyqzh">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="LoginClass" method="post">
<table>
<tr>
<td>User Name :</td><td><input type="text" name="Uname"></td>
</tr>
<tr>
<td>Password :</td><td><input type="text" name="Pwd"></td>
</tr>
<tr>
<td><input type="submit" value="Login"></td>
</tr>
</table>
</form>
</body>
</html>
Struts.xml :
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://ift.tt/1iwXH3l">
<struts>
<package name="Default" extends="Struts_default">
<action name="LoginClass" class="com.struts2.LoginCheckingClass" method="execute">
<result name="success">/LoginSuccessPage.jsp</result>
<result name="Notsuccess">/Home.jsp</result>
</action>
</package>
</struts>
LoginCheckingClass.java :
package com.struts2;
public class LoginCheckingClass {
public String Uname;
public String Pwd;
public void setUname(String uname)
{
this.Uname = uname;
}
public void getPwd(String pwd)
{
this.Pwd = pwd;
}
public String execute() {
if(Pwd == "mani" && Uname == "mani")
{
return "success";
}
else
{
return "Notsuccess";
}
}
}
Web.xml :
<web-app xmlns="http://ift.tt/nSRXKP"
xmlns:xsi="http://ift.tt/ra1lAU"
xsi:schemaLocation="http://ift.tt/nSRXKP
http://ift.tt/LU8AHS"
version="2.5">
<display-name>Struts2Application</display-name>
<welcome-file-list>
<welcome-file>home.jsp</welcome-file>
</welcome-file-list>
<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>
</web-app>
This problem raised for me in earlier date so i fixed by this Struts2:There is no Action mapped for namespace [/] and action name [hello] associated with context path [/struts2App1] but now could not fix this.
Someone tell me where i am doing mistake?
No comments:
Post a Comment