You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/01/30 20:22:54 UTC
DO NOT REPLY [Bug 16616] New: -
SaveRegistrationAction does not cancel correctly
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16616>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16616
SaveRegistrationAction does not cancel correctly
Summary: SaveRegistrationAction does not cancel correctly
Product: Struts
Version: 1.1 Beta 3
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Minor
Priority: Other
Component: Example
AssignedTo: struts-dev@jakarta.apache.org
ReportedBy: bonanno@us.ibm.com
This is a minor problem but the struts example does not go to the correct page
when cancelling out of creating a new registration.
// Was this transaction cancelled?
if (isCancelled(request)) {
if (log.isTraceEnabled()) {
log.trace(" Transaction '" + action +
"' was cancelled");
}
session.removeAttribute(Constants.SUBSCRIPTION_KEY);
return (mapping.findForward("success"));
}
The referenced code always returns the success forward mapping. This mapping is
correct for the case when cancelling the registration for an existing user but
not correct for cancelling creating a new registration. The success page tries
to take the mainMenu.jsp, but since the user is not logged in the wind up on
the logon page. Not what they expect.
The fix is easy. Use the action to determine that ActionForward.
if ("Create".equals(action) ) {
return (mapping.findForward("cancel"));
}
else {
return (mapping.findForward("success"));
}
The second problem in saveRegistrationAction is that it does not correctly
implement the inputForward property of the controller.
<set-property property="inputForward" value="true"/>
The RequestUtils.forwardURL should be used when inputForward is set to true.
// Report any errors we have discovered back to the original form
if (!errors.isEmpty()) {
saveErrors(request, errors);
saveToken(request);
return (mapping.getInputForward());
}
the return ( mapping.getInputForward()); should be replaced with
ActionForward actionForward = null;
ModuleConfig config = (ModuleConfig) request.getAttribute
(org.apache.struts.Globals.MODULE_KEY);
if (config != null && config.getControllerConfig().getInputForward()) {
ForwardConfig forward = mapping.findForward(mapping.getInput());
String uri = RequestUtils.forwardURL(request, forward);
actionForward = new ActionForward( uri );
}
else {
actionForward = new ActionForward(mapping.getInput());
}
return actionForward;
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org