I'm still fairly new to Struts (for a legacy project for current employer), in this case I am using Struts 1 so not sure if that matters.
I am trying to edit an action that has a bunch of forwards but for simplicity I have just included one. This particular forward just maps to a static JSP and can normally be accessed without having to login to the application.
So normally this page is accessed at (assuming I'm running this locally):
https://localhost/sc.do?page=download
The forward is set as:
<forward name="download" path=".downloadPage"/>
Now all I tried doing was changing the name download
to something else (in the forward below), such as downloadtest
, I made sure to rebuild it, etc and relaunched, now I cannot access it at
https://localhost/sc.do?page=download
but neither can I access the page at: https://localhost/sc.do?page=downloadtest
I'm really confused as to what else there would be in a configuration file that would prevent this from working, I have been reading tutorials and from my understanding this should work. Any advice is greatly appreciated.
<action path="/sc"
type="com.somecompany.wa.actions.PageDispatchAction"
name="scAdminForm"
parameter="page">
<set-property property="secure" value="true"/>
<forward name="downloadtest" path=".downloadPage"/>
</action>
This is the com.somecompany.wa.actions.PageDispatchAction class:
public class PageDispatchAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionContext context = new ActionContext(mapping, form, request, response);
Command command = new CheckPageSecurityCommand();
boolean stop = command.execute(context);
if (stop) {
return null;
} else {
return (ActionForward) context.get("forward");
}
}
// redirects control to logout page
// calls to this method should be followed by return null or end of method.
protected void redirectToLogout(HttpServletRequest request, HttpServletResponse response) throws Exception {
ServletWebContext context = new ServletWebContext(request.getSession(true).getServletContext(), request, response);
Command command = new RedirectToLogoutCommand();
command.execute(context);
}
}