Revision: 899
          http://stripes.svn.sourceforge.net/stripes/?rev=899&view=rev
Author:   bengunter
Date:     2008-05-09 21:30:37 -0700 (Fri, 09 May 2008)

Log Message:
-----------
Fixed STS-558: The attribute 'enctype' of the form tag is not cleared after 
rendering a form. Tag properties like setFoo(foo) that pass through to 
set("foo", foo) when called by code other than the servlet container itself can 
cause problems like this with tag pooling. Only the "method" and "enctype" 
setters are called from other code, so I made them properties of the tag and 
clear them at the end of doEndTag(). See also STS-475, which addressed a 
similar problem.

Modified Paths:
--------------
    trunk/stripes/src/net/sourceforge/stripes/tag/FormTag.java

Modified: trunk/stripes/src/net/sourceforge/stripes/tag/FormTag.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/tag/FormTag.java  2008-05-10 
03:40:16 UTC (rev 898)
+++ trunk/stripes/src/net/sourceforge/stripes/tag/FormTag.java  2008-05-10 
04:30:37 UTC (rev 899)
@@ -55,6 +55,8 @@
     private String focus;
     private boolean focusSet = false;
     private boolean partial = false;
+    private String enctype = null;
+    private String method = null;
 
     /** Stores the value of the action attribute before the context gets 
appended. */
     private String actionWithoutContext;
@@ -134,6 +136,16 @@
     /** Sets the flag that indicates if this is a partial form. */
     public void setPartial(boolean partial) { this.partial = partial; }
 
+    /** Sets the form encoding. */
+    public void setEnctype(String enctype) { this.enctype = enctype; }
+    /** Gets the form encoding. */
+    public String getEnctype() { return enctype; };
+
+    /** Sets the HTTP method to use when the form is submitted. */
+    public void setMethod(String method) { this.method = method; }
+    /** Gets the HTTP method to use when the form is submitted. */
+    public String getMethod() { return method; }
+
     ////////////////////////////////////////////////////////////
     // Additional attributes specific to the form tag
     ////////////////////////////////////////////////////////////
@@ -143,12 +155,6 @@
     public void   setAcceptcharset(String acceptCharset) { 
set("accept-charset", acceptCharset); }
     public String getAcceptcharset() { return get("accept-charset"); }
 
-    public void   setEnctype(String enctype) { set("enctype", enctype); }
-    public String getEnctype() { return get("enctype"); };
-
-    public void   setMethod(String method) { set("method", method); }
-    public String getMethod() { return get("method"); }
-
     public void   setName(String name) { set("name", name); }
     public String getName() { return get("name"); }
 
@@ -211,6 +217,8 @@
                 setMethod("post");
             }
 
+            set("method", getMethod());
+            set("enctype", getEnctype());
             set("action", buildAction());
 
             JspWriter out = getPageContext().getOut();
@@ -252,8 +260,10 @@
             // Clean up any state the container won't reset during tag pooling
             this.actionBeanClass = null;
             this.actionWithoutContext = null;
+            this.enctype = null;
             this.fieldsPresent.clear();
             this.focusSet = false;
+            this.method = null;
             this.urlBuilder = null;
         }
         catch (IOException ioe) {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to