You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Niall Pemberton (JIRA)" <ji...@apache.org> on 2006/11/04 04:23:57 UTC

[jira] Updated: (STR-1242) [taglib] Allow relative URL in action attribute of tag

     [ http://issues.apache.org/struts/browse/STR-1242?page=all ]

Niall Pemberton updated STR-1242:
---------------------------------

    Comment: was deleted

> [taglib] Allow relative URL in action attribute of <html:form .. > tag
> ----------------------------------------------------------------------
>
>                 Key: STR-1242
>                 URL: http://issues.apache.org/struts/browse/STR-1242
>             Project: Struts 1
>          Issue Type: Improvement
>          Components: Taglibs
>    Affects Versions: Future
>         Environment: Operating System: All
> Platform: Other
>            Reporter: Erik Tennant
>         Assigned To: Ted Husted
>            Priority: Minor
>             Fix For: Future
>
>
> I needed (for reasons beyond my control) to have <html:form..> create an 
> action="" with a relative 
> URL. Searching the mailing list, I ran across others who were seeking similar 
> functionality. I 
> wrote up a simple addition to FormTag.java that allows an optional isRelative 
> attribute inside the 
> form tag.
> Image tags have something functionally equivalent, so I'm guessing it may be 
> functionality you are 
> interested in.
> If you need something else from me, let me know.
> Thanks,
> Erik
> This diff is against 1.1rc1
> --- FormTag.java.rc1        2003-02-25 15:56:32.000000000 -0600
> +++ FormTag.java.rc1.new        2003-02-25 15:56:32.000000000 -0600
> @@ -214,6 +214,12 @@
>       */
>      protected String beanType = null;
>  
> +    /**
> +     * Whether or not the action="" should be a relative URL. Default is
> +     * false, to maintain backwards compatibility.
> +     */
> +    protected String isRelative = null;
> +
>      // ------------------------------------------------------------- Properties
>  
>      /**
> @@ -488,6 +494,23 @@
>  
>      }
>  
> +    /**
> +     * Is the action="" relative? a value of "true" (case insensitive) 
> indicates it is
> +     *
> +     * @param value
> +     */
> +    public void setIsRelative (String value) {
> +
> +        this.isRelative = value;
> +
> +    }
> +
> +    public String getIsRelative () {
> +
> +        return isRelative;
> +
> +    }
> +
>      // --------------------------------------------------------- Public Methods
>  
>      /**
> @@ -509,7 +532,11 @@
>           results.append(" method=\"");
>           results.append(method == null ? "post" : method);
>           results.append("\" action=\"");
> -         results.append(response.encodeURL(RequestUtils.getActionMappingURL
> (action, pageContext)));
> +        if ("true".equalsIgnoreCase(isRelative ) ) {
> +            results.append(response.encodeURL(action));
> +        } else {
> +            results.append(response.encodeURL(RequestUtils.getActionMappingURL
> (action, 
> pageContext)));
> +        }         
>           results.append("\"");
>           if (styleClass != null) {
>               results.append(" class=\"");
> @@ -696,6 +723,7 @@
>          styleId = null;
>          target = null;
>          type = null;
> +        isRelative = null;
>  
>      }
>  
> --- struts-html.tld.rc1        2003-02-25 15:56:32.000000000 -0600
> +++ struts-html.tld.rc1.new        2003-02-25 15:56:32.000000000 -0600
> @@ -618,6 +618,11 @@
>  <rtexprvalue>true</rtexprvalue>
>  </attribute>
>  <attribute>
> +<name>isRelative</name>
> +<required>false</required>
> +<rtexprvalue>true</rtexprvalue>
> +</attribute>
> +<attribute>
>  <name>enctype</name>
>  <required>false</required>
>  <rtexprvalue>true</rtexprvalue>

-- 
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