Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-2873

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.3.4
    • None
    • None
    • 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

      Attachments

        Activity

          People

            Unassigned Unassigned
            alonsodomin Alonso Dominguez
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: