craigmcc 01/04/28 20:11:40
Modified: src/share/org/apache/struts/taglib/html FormTag.java
Log:
Migrate the attributes created by the <html:form> tag (the form tag
instance itself, and a reference to the form bean itself) from page scope
to request scope. Among other things, this change enables the use of a
separate JSP page (accessed by <jsp:include> or the template tag library)
to contain the input fields, nested inside an <html:form> tag instance.
PR: Bugzilla #932
Submitted by: Lajos Incze <[EMAIL PROTECTED]>
Revision Changes Path
1.11 +12 -8
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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- FormTag.java 2001/04/19 22:58:40 1.10
+++ FormTag.java 2001/04/29 03:11:39 1.11
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java,v 1.10
2001/04/19 22:58:40 craigmcc Exp $
- * $Revision: 1.10 $
- * $Date: 2001/04/19 22:58:40 $
+ * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java,v 1.11
2001/04/29 03:11:39 craigmcc Exp $
+ * $Revision: 1.11 $
+ * $Date: 2001/04/29 03:11:39 $
*
* ====================================================================
*
@@ -87,7 +87,7 @@
* properties correspond to the various fields of the form.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.10 $ $Date: 2001/04/19 22:58:40 $
+ * @version $Revision: 1.11 $ $Date: 2001/04/29 03:11:39 $
*/
public class FormTag extends TagSupport {
@@ -512,7 +512,8 @@
ResponseUtils.write(pageContext, results.toString());
// Store this tag itself as a page attribute
- pageContext.setAttribute(Constants.FORM_KEY, this);
+ pageContext.setAttribute(Constants.FORM_KEY, this,
+ PageContext.REQUEST_SCOPE);
// Locate or create the bean associated with our form
int scope = PageContext.SESSION_SCOPE;
@@ -535,7 +536,8 @@
}
pageContext.setAttribute(name, bean, scope);
}
- pageContext.setAttribute(Constants.BEAN_KEY, bean);
+ pageContext.setAttribute(Constants.BEAN_KEY, bean,
+ PageContext.REQUEST_SCOPE);
// Continue processing this page
return (EVAL_BODY_INCLUDE);
@@ -551,8 +553,10 @@
public int doEndTag() throws JspException {
// Remove the page scope attributes we created
- pageContext.removeAttribute(Constants.BEAN_KEY);
- pageContext.removeAttribute(Constants.FORM_KEY);
+ pageContext.removeAttribute(Constants.BEAN_KEY,
+ PageContext.REQUEST_SCOPE);
+ pageContext.removeAttribute(Constants.FORM_KEY,
+ PageContext.REQUEST_SCOPE);
// Render a tag representing the end of our current form
StringBuffer results = new StringBuffer("</form>");