struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Graham" <dgraham1...@hotmail.com>
Subject Re: cvs commit: jakarta-struts/src/share/org/apache/struts/util RequestUtils.java
Date Sun, 18 May 2003 16:29:48 GMT
>If only TagLibs use isXhtml() wouldn't placing it under
>o.a.s.taglib.util prevent RequestUtils from getting
>even bigger than what it already is ?

I agree but wan't sure how everyone would feel about me adding a class at 
this point.  We can move that method with the rest of the JSP related 
methods to a new class for 1.2.

David

>
>
>
>dgraham@apache.org wrote:
>
>>dgraham     2003/05/16 18:56:51
>>
>>  Modified:    src/share/org/apache/struts/taglib/html
>>                        JavascriptValidatorTag.java FormTag.java
>>                        BaseTag.java
>>               src/share/org/apache/struts/util RequestUtils.java
>>  Log:
>>  Moved xhtml check to RequestUtils instead of duplicating the logic in 
>>many
>>
>>  different classes.  This method should move to our view utility class 
>>when
>>
>>  RequestUtils is refactored.
>>   Revision  Changes    Path
>>  1.26      +5 -8      
>>jakarta-struts/src/share/org/apache/struts/taglib/html/JavascriptValidatorTag.java
>>   Index: JavascriptValidatorTag.java
>>  ===================================================================
>>  RCS file: 
>>/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/JavascriptValidatorTag.java,v
>>  retrieving revision 1.25
>>  retrieving revision 1.26
>>  diff -u -r1.25 -r1.26
>>  --- JavascriptValidatorTag.java	4 Apr 2003 06:41:09 -0000	1.25
>>  +++ JavascriptValidatorTag.java	17 May 2003 01:56:51 -0000	1.26
>>  @@ -695,10 +695,7 @@
>>        * Returns true if this is an xhtml page.
>>        */
>>       private boolean isXhtml() {
>>  -        String xhtml =
>>  -            (String) this.pageContext.getAttribute(Globals.XHTML_KEY, 
>>PageContext.PAGE_SCOPE);
>>  -
>>  -        return ("true".equalsIgnoreCase(xhtml));
>>  +        return RequestUtils.isXhtml(this.pageContext);
>>       }
>>         /**
>>     1.48      +6 -10     
>>jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java
>>   Index: FormTag.java
>>  ===================================================================
>>  RCS file: 
>>/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java,v
>>  retrieving revision 1.47
>>  retrieving revision 1.48
>>  diff -u -r1.47 -r1.48
>>  --- FormTag.java	15 May 2003 02:33:40 -0000	1.47
>>  +++ FormTag.java	17 May 2003 01:56:51 -0000	1.48
>>  @@ -842,13 +842,9 @@
>>         /**
>>        * Returns true if this tag should render as xhtml.
>>  -     * @since Struts 1.1
>>        */
>>  -    protected boolean isXhtml() {
>>  -        String xhtml =
>>  -            (String) this.pageContext.getAttribute(Globals.XHTML_KEY, 
>>PageContext.PAGE_SCOPE);
>>  -
>>  -        return ("true".equalsIgnoreCase(xhtml));
>>  +    private boolean isXhtml() {
>>  +        return RequestUtils.isXhtml(this.pageContext);
>>       }
>>         /**
>>     1.16      +7 -17     
>>jakarta-struts/src/share/org/apache/struts/taglib/html/BaseTag.java
>>   Index: BaseTag.java
>>  ===================================================================
>>  RCS file: 
>>/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/BaseTag.java,v
>>  retrieving revision 1.15
>>  retrieving revision 1.16
>>  diff -u -r1.15 -r1.16
>>  --- BaseTag.java	16 May 2003 12:34:50 -0000	1.15
>>  +++ BaseTag.java	17 May 2003 01:56:51 -0000	1.16
>>  @@ -71,6 +71,7 @@
>>     import org.apache.struts.Globals;
>>   import org.apache.struts.util.MessageResources;
>>  +import org.apache.struts.util.RequestUtils;
>>     /**
>>    * Renders an HTML <base> element with an href  @@ -146,6 +147,7 @@
>>        * @param uri  The portion of the url from the protocol name up to 
>>the query        * string.
>>        * @return String An HTML &lt;base&gt; element.
>>  +     * @since Struts 1.1
>>        */
>>       protected String renderBaseElement(
>>           String scheme,
>>  @@ -176,25 +178,13 @@
>>               tag.append("\"");
>>           }
>>            -        if (this.isXhtml()) {
>>  +        if (RequestUtils.isXhtml(this.pageContext)) {
>>               tag.append(" />");
>>           } else {
>>               tag.append(">");
>>           }
>>                     return tag.toString();
>>  -    }
>>  -
>>  -    /**
>>  -     * Returns true if the tag is in XHTML mode.
>>  -     */
>>  -    protected boolean isXhtml() {
>>  -        String xhtml =
>>  -            (String) this.pageContext.getAttribute(
>>  -                Globals.XHTML_KEY,
>>  -                PageContext.PAGE_SCOPE);
>>  -
>>  -        return "true".equalsIgnoreCase(xhtml);
>>       }
>>             /**
>>     1.102     +17 -4     
>>jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java
>>   Index: RequestUtils.java
>>  ===================================================================
>>  RCS file: 
>>/home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v
>>  retrieving revision 1.101
>>  retrieving revision 1.102
>>  diff -u -r1.101 -r1.102
>>  --- RequestUtils.java	10 May 2003 18:06:39 -0000	1.101
>>  +++ RequestUtils.java	17 May 2003 01:56:51 -0000	1.102
>>  @@ -1973,5 +1973,18 @@
>>             return URLEncoder.encode(url);
>>       }
>>  +     +    /**
>>  +     * Returns true if the custom tags are in XHTML mode.
>>  +     * @since Struts 1.1
>>  +     */
>>  +    public static boolean isXhtml(PageContext pageContext) {
>>  +        String xhtml =
>>  +            (String) pageContext.getAttribute(
>>  +                Globals.XHTML_KEY,
>>  +                PageContext.PAGE_SCOPE);
>>  +
>>  +        return "true".equalsIgnoreCase(xhtml);
>>  +    }
>>     }
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-dev-help@jakarta.apache.org
>

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Mime
View raw message