I tried out all the possible solution available on the internet.
error :
HTTP Status 404 - There is no Action mapped for namespace [/] and action name [validateLogin] associated with context path [/LoginApplication].
struts.xml file
<?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.devMode" value="true" />
<package name="hello" extends="struts-default">
<action name="validateLogin"
class="com.example.login.ValidationAction"
method="execute">
<result name="success">/result.jsp</result>
</action>
</package>
</struts>
index.jsp
<form action="validateLogin">
<table>
<tr>
<td><label for="username">Username</label></td><td><input type="text" name="username"></td>
</tr>
<tr>
<td><label for="password">Password</label></td><td><input type="password" name="password"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Login"></td>
</tr>
</table>
</form>
This error comes mostly when the package structure is not made correctly.
If the
web.xml
file andstruts.xml
file is created under correct package then both the XML files will be reflected automatically under Configuration files folder structure in Netbeans.Please refer the screenshot: