You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "A. Alonso DomÃnguez (JIRA)" <ji...@apache.org> on 2006/05/11 09:53:33 UTC
[jira] Created: (STR-2873) FormRenderer fails when retrieving the
real action URL for a from submission
FormRenderer fails when retrieving the real action URL for a from submission
----------------------------------------------------------------------------
Key: STR-2873
URL: http://issues.apache.org/struts/browse/STR-2873
Project: Struts Action 1
Type: Bug
Components: Faces
Versions: 1.3.4
Environment: Debian Linux 3.1 (Sarge), Jdk 1.5, Tomcat 5.5.9, myfaces 1.1.2, struts-tiles 1.3.4
Reporter: A. Alonso DomÃnguez
When the FormRenderer it's invoked to encode it's state to the ResponseWriter fails when it encodes the "action" attribute of the html form. This attribute must have the value of an Action path (like '/login.do') but it always obtains the URL of the ViewRoot. In a Tiles environment this URL is the same of the base definition.
The code that tries to find the action URL is as follows (line 280):
protected String action(FacesContext context, UIComponent component) {
String actionURL =
context.getApplication().getViewHandler().
getActionURL(context, context.getViewRoot().getViewId());
if (log.isTraceEnabled()) {
log.trace("getActionURL(" + context.getViewRoot().getViewId() +
") --> " + actionURL);
}
return (context.getExternalContext().encodeActionURL(actionURL));
}
The problem can be solved using the following code:
protected String action(FacesContext context, UIComponent component) {
//String actionURL =
// context.getApplication().getViewHandler().
// getActionURL(context, context.getViewRoot().getViewId());
FormComponent form = (FormComponent) component;
ModuleConfig moduleConfig = form.lookupModuleConfig(context);
String actionURL = context.getApplication().getViewHandler().
getActionURL(context, moduleConfig.getPrefix() + form.getAction());
if (log.isTraceEnabled()) {
log.trace("getActionURL(" + context.getViewRoot().getViewId() +
") --> " + actionURL);
}
return (context.getExternalContext().encodeActionURL(actionURL));
}
Should be this way?
Regards,
Alonso
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira