You will suppose this is a big question.but there might be a simple problem which I can’t find the reason.
There is a form( a simple login) whose action name is ‘loginAction’ in a jsp page called ‘index.jsp’ . In the action class, the execute() method checks whether the username,password are valid. If it is a valid login, execute() method returns SUCCESS which forward to another jsp page called ‘account.jsp’ in a folder called ‘jsp’ inside WEB-INF.
The problem is that, struts.xml forwards all valid logins to the relavant url , but the page(account.jsp) cannot be retrieved.Browser gives 404 error.But the url which the browser says ‘not available’ was just copied and pasted to the browser’s address bar manually. Then the page is displayed !!!
Here is the struts.xml file
<struts>
<include file="/struts_auth.xml" />
<package name="default" extends="struts-default" >
<action name="login" >
<result>index.jsp</result>
</action>
<action name="loginAction" class="com.app.action.LoginAction">
<result name="success">/auth/acc</result>
<result name="input">index.jsp</result>
</action>
</package>
Here is the struts_auth.xml file which is included in above struts.xml
<struts>
<package name="author" extends="default" namespace="/auth" >
<action name="acc">
<result name="success">/WEB-INF/jsp/account.jsp</result>
<result name="input">index.jsp</result>
</action>
</package>
and this is what browser says as the reason
description: The requested resource (/app/auth/acc) is not available. But if this url (http://localhost:8084/app/auth/acc)just copied into the browser’s address bar, it just shows the real page . Please let me know where my problem is.
For better understanding refer the following link. How to redirect to another action