Struts 1
  1. Struts 1
  2. STR-2873

FormRenderer fails when retrieving the real action URL for a from submission

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.3.4
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Debian Linux 3.1 (Sarge), Jdk 1.5, Tomcat 5.5.9, myfaces 1.1.2, struts-tiles 1.3.4

      Description

      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

        Activity

        Alonso Dominguez created issue -
        Jeff Turner made changes -
        Field Original Value New Value
        Project Import Mon Feb 01 01:03:21 UTC 2010 [ 1264986201992 ]
        Mark Thomas made changes -
        Workflow jira [ 12490760 ] Default workflow, editable Closed status [ 12546063 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12546063 ] jira [ 12549360 ]
        Mark Thomas made changes -
        Workflow jira [ 12549360 ] Default workflow, editable Closed status [ 12558702 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12558702 ] jira [ 12586879 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Alonso Dominguez
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development