Author: dolander
Date: Thu Dec  2 09:56:23 2004
New Revision: 109511

URL: http://svn.apache.org/viewcvs?view=rev&rev=109511
Log:
Remove the doNaming() method and consolidate the naming (id/name attributes) of 
all of the HTML form elements into a new
createName() method.  THis was done so that all the controls do naming in a 
consistent manner.



Added:
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/AbstractHtmlDataSourceState.java
Modified:
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBox.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBoxGroup.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/FileUpload.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Hidden.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlDataSourceTag.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Select.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/TextArea.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/TextBox.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputBooleanTag.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputFileTag.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputHiddenTag.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputTextTag.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/SelectTag.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java
   
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TextAreaTag.java
   
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/cr183774.xml

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBox.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBox.java?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBox.java&r1=109510&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBox.java&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBox.java
        (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBox.java
        Thu Dec  2 09:56:23 2004
@@ -20,6 +20,7 @@
 import org.apache.beehive.netui.pageflow.ProcessPopulate;
 import org.apache.beehive.netui.pageflow.RequestParameterHandler;
 import org.apache.beehive.netui.tags.IHtmlAccessable;
+import org.apache.beehive.netui.tags.ByRef;
 import org.apache.beehive.netui.tags.naming.FormDataNameInterceptor;
 import org.apache.beehive.netui.tags.naming.IndexedNameInterceptor;
 import org.apache.beehive.netui.tags.naming.PrefixNameInterceptor;
@@ -252,7 +253,7 @@
      */
     public int doEndTag() throws JspException
     {
-        String idScript = null;
+        //String idScript = null;
 
         Tag parent = getParent();
         if (parent instanceof CheckBoxGroup)
@@ -262,11 +263,10 @@
         if (hasErrors())
             return reportAndExit(EVAL_PAGE);
 
-        String realName = doNaming(OLDVALUE_SUFFIX);
-        if (hasErrors())
-            return reportAndExit(EVAL_PAGE);
+        ByRef ref = new ByRef();
+        createName(_state, ref, OLDVALUE_SUFFIX);
 
-        String hiddenParamName = realName + OLDVALUE_SUFFIX;
+        String hiddenParamName = _state.name + OLDVALUE_SUFFIX;
         ServletRequest req = pageContext.getRequest();
 
         // @todo: should we not support the "on" version of this?
@@ -290,10 +290,8 @@
         }
         _state.disabled = isDisabled();
 
-        idScript = renderTagId(_state, realName, false, true);
-
         //Create a hidden field to store the CheckBox oldValue
-        String oldValue = req.getParameter(realName);
+        String oldValue = req.getParameter(_state.name);
         WriteRenderAppender writer = new WriteRenderAppender(pageContext);
 
         // if the checkbox is disabled we need to not write out the hidden
@@ -314,14 +312,11 @@
 
         _state.type = INPUT_CHECKBOX;
 
-        if (_dataSource != null)
-            _state.name = realName;
-
         TagRenderingBase br = 
TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_BOOLEAN_TAG, req);
         br.doStartTag(writer, _state);
 
-        if (idScript != null)
-            write(idScript);
+        if (!ref.isNull())
+            write((String) ref.getRef());
 
         // Continue processing this page
         localRelease();

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBoxGroup.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBoxGroup.java?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBoxGroup.java&r1=109510&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBoxGroup.java&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBoxGroup.java
   (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/CheckBoxGroup.java
   Thu Dec  2 09:56:23 2004
@@ -338,7 +338,6 @@
 
         // if the checkbox group is disabled do not write out the
         // hidden field.
-        //StringBuilder results = new StringBuilder(64);
         _writer = new WriteRenderAppender(pageContext);
         if (!_repeater && !_disabled) {
 
@@ -457,7 +456,6 @@
             if (idScript != null)
                 write(idScript);
 
-            //write(results.toString());
             localRelease();
             return EVAL_PAGE;
         }

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/FileUpload.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/FileUpload.java?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/FileUpload.java&r1=109510&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/FileUpload.java&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/FileUpload.java
      (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/FileUpload.java
      Thu Dec  2 09:56:23 2004
@@ -22,6 +22,7 @@
 import org.apache.beehive.netui.tags.rendering.InputFileTag;
 import org.apache.beehive.netui.tags.rendering.TagRenderingBase;
 import org.apache.beehive.netui.tags.rendering.WriteRenderAppender;
+import org.apache.beehive.netui.tags.ByRef;
 import org.apache.beehive.netui.util.Bundle;
 
 import javax.servlet.http.HttpServletRequest;
@@ -226,22 +227,23 @@
             return EVAL_PAGE;
         }
 
-        String idScript = null;
-
         // Create the state for the input tag.
-        String realName = doNaming(null);
-        if (_dataSource != null) {
-            _state.name = realName;
-        }
-
-        String tagId = getTagId();
-        if (tagId != null) {
-            Form parentForm = getNearestForm();
-            if (parentForm != null) {
-                parentForm.addTagID(tagId, realName);
-            }
-            idScript = addTagIdMapping(tagId, realName);
-        }
+        ByRef ref = new ByRef();
+        createName(_state, ref, null);
+        //String realName = doNaming(null);
+        //if (_dataSource != null) {
+        //    _state.name = realName;
+        //}
+
+        //String idScript = null;
+        //String tagId = getTagId();
+        //if (tagId != null) {
+        //    Form parentForm = getNearestForm();
+        //    if (parentForm != null) {
+        //        parentForm.addTagID(tagId, _state.);
+        //    }
+        //    idScript = addTagIdMapping(tagId, realName);
+        //}
 
         if (hasErrors())
             return reportAndExit(EVAL_PAGE);
@@ -250,8 +252,8 @@
         TagRenderingBase br = 
TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_FILE_TAG, req);
         br.doStartTag(writer, _state);
 
-        if (idScript != null)
-            write(idScript);
+        if (!ref.isNull())
+            write((String) ref.getRef());
 
         localRelease();
         return EVAL_PAGE;

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Hidden.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Hidden.java?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Hidden.java&r1=109510&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Hidden.java&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Hidden.java
  (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Hidden.java
  Thu Dec  2 09:56:23 2004
@@ -18,6 +18,7 @@
 package org.apache.beehive.netui.tags.html;
 
 import org.apache.beehive.netui.tags.HtmlUtils;
+import org.apache.beehive.netui.tags.ByRef;
 import org.apache.beehive.netui.tags.rendering.*;
 import org.apache.beehive.netui.util.Bundle;
 
@@ -48,7 +49,7 @@
 {
     private InputHiddenTag.State _state = new InputHiddenTag.State();
 
-    private String _value; // The value of the Hidden field.
+    private String _value;
     private Object _dataInput;
 
     /**
@@ -137,9 +138,7 @@
      */
     public int doEndTag() throws JspException
     {
-        String idScript = null;
         Object val = evaluateDataSource();
-        String name = null;
 
         ServletRequest req = pageContext.getRequest();
 
@@ -148,21 +147,16 @@
         }
 
         // if there were expression errors report them
-        if (hasErrors()) {
-            reportErrors();
-            localRelease();
-            return SKIP_BODY;
-        }
+        if (hasErrors())
+            return reportAndExit(SKIP_BODY);
 
         if (val != null) {
             _value = val.toString();
         }
 
         // Create an appropriate "input" element based on our parameters
-        if (_dataSource != null) {
-            name = doNaming(null);
-            _state.name = name;
-        }
+        ByRef ref = new ByRef();
+        createName(_state, ref, null);
 
         if (_value != null) {
             StringBuilder sb = new StringBuilder(_value.length() + 16);
@@ -175,25 +169,14 @@
         if (_state.value == null)
             _state.value = "";
 
-        // output the id
-        //_state.name = doNaming();
-
-        // we assume that tagId will over have override id if both
-        // are defined.
-        if (_state.id != null) {
-            idScript = renderTagId(_state, null, true, false);
-        }
-        if (hasErrors())
-            return reportAndExit(SKIP_BODY);
-
         WriteRenderAppender writer = new WriteRenderAppender(pageContext);
         TagRenderingBase hiddenTag = 
TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_HIDDEN_TAG, req);
 
         hiddenTag.doStartTag(writer, _state);
         hiddenTag.doEndTag(writer);
 
-        if (idScript != null)
-            write(idScript);
+        if (!ref.isNull())
+            write((String) ref.getRef());
 
         // Continue processing this page
         localRelease();

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlBaseTag.java?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlBaseTag.java&r1=109510&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlBaseTag.java&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
     (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
     Thu Dec  2 09:56:23 2004
@@ -492,8 +492,7 @@
      * @param addToForm
      * @return String
      */
-    protected final String renderTagId(AbstractHtmlState state, String 
realName, boolean outputAsId,
-                                       boolean addToForm)
+    protected final String renderTagId(AbstractHtmlState state, String 
realName, boolean outputAsId, boolean addToForm)
     {
         assert (state != null) : "Parameter 'state' must not be null.";
 

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlDataSourceTag.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlDataSourceTag.java?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlDataSourceTag.java&r1=109510&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlDataSourceTag.java&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlDataSourceTag.java
       (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/HtmlDataSourceTag.java
       Thu Dec  2 09:56:23 2004
@@ -20,6 +20,8 @@
 import org.apache.beehive.netui.tags.AbstractClassicTag;
 import org.apache.beehive.netui.tags.ExpressionHandling;
 import org.apache.beehive.netui.tags.IHtmlIdWriter;
+import org.apache.beehive.netui.tags.ByRef;
+import org.apache.beehive.netui.tags.rendering.AbstractHtmlDataSourceState;
 
 import javax.servlet.jsp.JspException;
 import java.util.List;
@@ -116,30 +118,57 @@
      * a tag may need to write out a hidden field with additional information. 
 If the
      * hiddenSuffix is passed and ID transarency is on, the "name" + 
hiddenSuffix will also
      * be written to the ID map.
-     * @param hiddenSuffix a value of a hidden field that will be written to 
the
+     * @param state
+     * @param javaScript
+     * @param hiddenSuffix hiddenSuffix a value of a hidden field that will be 
written to the
      * ID map if an ID Map is being generated.
-     * @return String the name of this form element.
+     * @throws JspException
      */
-    protected String doNaming(String hiddenSuffix)
+    protected void createName(AbstractHtmlDataSourceState state, ByRef 
javaScript, String hiddenSuffix)
             throws JspException
     {
+        assert (javaScript != null) : "paramater 'javaScript' may not be null";
+        assert (state != null) : "parameter 'state' may not be null";
         assert (_dataSource != null) : "dataSource is Null";
 
+        // create the expression
         String datasource = "{" + _dataSource + "}";
         String expr = applyNamingChain(datasource);
-        String name = expr;
+
+        // The default name is the expression
+        String retName = expr;
+
+        // figure out how the id is being written out
         IHtmlIdWriter idWriter = getNearestIdWriter();
         if (idWriter != null) {
             String id = getTagId();
             if (id == null) {
                 id = idWriter.getNextId();
             }
-            name = idWriter.writeId(id, expr);
+            retName = idWriter.writeId(id, expr);
             if (hiddenSuffix != null)
                 idWriter.writeId(id + hiddenSuffix, expr);
         }
-        return name;
 
+        if (state.id == null) {
+            state.name = retName;
+            return;
+        }
+
+        if (retName == null)
+            retName = rewriteName(state.id);
+
+        String idScript = addTagIdMapping(state.id, retName);
+
+        // form keeps track of this so that it can add this control to it's 
focus map
+        Form parentForm = getNearestForm();
+        if (parentForm != null)
+            parentForm.addTagID(state.id, retName);
+
+        if (idScript != null)
+            javaScript.setRef(idScript);
+        state.name = retName;
+        state.id = null;
     }
 
     /**

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Select.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Select.java?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Select.java&r1=109510&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Select.java&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Select.java
  (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Select.java
  Thu Dec  2 09:56:23 2004
@@ -25,6 +25,7 @@
 import org.apache.beehive.netui.tags.naming.IndexedNameInterceptor;
 import org.apache.beehive.netui.tags.naming.PrefixNameInterceptor;
 import org.apache.beehive.netui.tags.rendering.*;
+import org.apache.beehive.netui.tags.ByRef;
 import org.apache.beehive.netui.util.Bundle;
 import org.apache.beehive.netui.util.iterator.IteratorFactory;
 import org.apache.beehive.netui.util.iterator.IteratorFactoryException;
@@ -727,7 +728,9 @@
         _state.disabled = isDisabled();
 
         //Create hidden field for state tracking
-        String realName = doNaming(null);
+        ByRef ref = new ByRef();
+        createName(_state, ref, null);
+
         if (hasErrors())
             return reportAndExit(EVAL_PAGE);
 
@@ -738,7 +741,7 @@
         if (!_state.disabled) {
             _hiddenState.clear();
             String hiddenParamName = null;
-            hiddenParamName = realName + OLDVALUE_SUFFIX;
+            hiddenParamName = _state.name + OLDVALUE_SUFFIX;
             _hiddenState.name = hiddenParamName;
             _hiddenState.value = "true";
 
@@ -752,9 +755,6 @@
         if (fmtErrors != null)
             write(fmtErrors);
 
-        // Create an appropriate "form" element based on our parameters
-        _state.name = realName;
-        scriptId = renderTagId(_state, realName, false, true);
 
         TagRenderingBase br = 
TagRenderingBase.Factory.getRendering(TagRenderingBase.SELECT_TAG, req);
         br.doStartTag(writer, _state);

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/TextArea.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/TextArea.java?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/TextArea.java&r1=109510&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/TextArea.java&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/TextArea.java
        (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/TextArea.java
        Thu Dec  2 09:56:23 2004
@@ -18,6 +18,7 @@
 package org.apache.beehive.netui.tags.html;
 
 import org.apache.beehive.netui.tags.HtmlUtils;
+import org.apache.beehive.netui.tags.ByRef;
 import org.apache.beehive.netui.tags.rendering.AbstractHtmlState;
 import org.apache.beehive.netui.tags.rendering.TagRenderingBase;
 import org.apache.beehive.netui.tags.rendering.TextAreaTag;
@@ -161,7 +162,6 @@
     {
         ServletRequest req = pageContext.getRequest();
         Object textObject = null;
-        String scriptId = null;
 
         // Get the value of the data source.  The object will not be null.
         Object val = evaluateDataSource();
@@ -169,20 +169,14 @@
         assert(textObject != null);
 
         // setup the rest of the state.
-        _state.name = doNaming(null);
+        ByRef ref = new ByRef();
+        createName(_state, ref, null);
 
-        scriptId = renderTagId(_state, _state.name, false, true);
         _state.disabled = isDisabled();
 
         // if there were expression errors report them
-        if (hasErrors()) {
-            reportErrors();
-            localRelease();
-            return EVAL_PAGE;
-        }
-
-        // Buffer to write the results
-        //StringBuilder results = new StringBuilder(64);
+        if (hasErrors())
+            return reportAndExit(EVAL_PAGE);
 
         // if there were format errors then report them
         if (_formatErrors) {
@@ -211,18 +205,12 @@
         br.doEndTag(writer);
 
         // if there are errors report them...
-        if (hasErrors()) {
-            reportErrors();
-            localRelease();
-            return EVAL_PAGE;
-        }
+        if (hasErrors())
+            return reportAndExit(EVAL_PAGE);
 
         // report any script
-        if (scriptId != null)
-            write(scriptId);
-        //results.append(scriptId);
-
-        //write(results.toString());
+        if (!ref.isNull())
+            write((String) ref.getRef());
 
         localRelease();
         return EVAL_PAGE;

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/TextBox.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/TextBox.java?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/TextBox.java&r1=109510&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/TextBox.java&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/TextBox.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/TextBox.java
 Thu Dec  2 09:56:23 2004
@@ -19,6 +19,7 @@
 
 import org.apache.beehive.netui.tags.HtmlUtils;
 import org.apache.beehive.netui.tags.IHtmlAccessable;
+import org.apache.beehive.netui.tags.ByRef;
 import org.apache.beehive.netui.tags.rendering.*;
 import org.apache.beehive.netui.util.Bundle;
 
@@ -234,7 +235,6 @@
      */
     public int doEndTag() throws JspException
     {
-        String scriptId = null;
         ServletRequest req = pageContext.getRequest();
 
         // Create an appropriate "input" element based on our parameters
@@ -245,9 +245,11 @@
             _state.type = INPUT_TEXT;
         }
 
+
         // Create the state for the input tag
-        _state.name = doNaming(null);
-        scriptId = renderTagId(_state, _state.name, false, true);
+        ByRef ref = new ByRef();
+        createName(_state, ref, null);
+
         _state.disabled = isDisabled();
 
         // Create the text value of the TextBox
@@ -288,8 +290,8 @@
         br.doEndTag(writer);
 
         // write any script that needs to be written
-        if (scriptId != null)
-            write(scriptId);
+        if (!ref.isNull())
+            write((String) ref.getRef());
 
         localRelease();
         return EVAL_PAGE;

Added: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/AbstractHtmlDataSourceState.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/AbstractHtmlDataSourceState.java?view=auto&rev=109511
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/AbstractHtmlDataSourceState.java
        Thu Dec  2 09:56:23 2004
@@ -0,0 +1,12 @@
+package org.apache.beehive.netui.tags.rendering;
+
+abstract public class AbstractHtmlDataSourceState extends AbstractHtmlState
+{
+    public String name;
+
+    public void clear()
+    {
+        super.clear();
+        name = null;
+    }
+}

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputBooleanTag.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputBooleanTag.java?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputBooleanTag.java&r1=109510&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputBooleanTag.java&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputBooleanTag.java
    (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputBooleanTag.java
    Thu Dec  2 09:56:23 2004
@@ -35,12 +35,11 @@
         xhtml.put(INPUT_BOOLEAN_TAG, new XhtmlRendering());
     }
 
-    public static class State extends AbstractHtmlState
+    public static class State extends AbstractHtmlDataSourceState
     {
         public String type;
         public boolean disabled;
         public boolean checked;
-        public String name;
         public String value;
 
         public void clear()
@@ -50,7 +49,6 @@
             type = null;
             disabled = false;
             checked = false;
-            name = null;
             value = null;
         }
     }

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputFileTag.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputFileTag.java?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputFileTag.java&r1=109510&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputFileTag.java&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputFileTag.java
       (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputFileTag.java
       Thu Dec  2 09:56:23 2004
@@ -34,16 +34,14 @@
         xhtml.put(INPUT_FILE_TAG, new XhtmlRendering());
     }
 
-    public static class State extends AbstractHtmlState
+    public static class State extends AbstractHtmlDataSourceState
     {
-        public String name;
         public boolean readonly;
 
         public void clear()
         {
             super.clear();
 
-            name = null;
             readonly = false;
         }
     }

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputHiddenTag.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputHiddenTag.java?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputHiddenTag.java&r1=109510&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputHiddenTag.java&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputHiddenTag.java
     (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputHiddenTag.java
     Thu Dec  2 09:56:23 2004
@@ -19,7 +19,6 @@
 
 import org.apache.beehive.netui.tags.html.HtmlConstants;
 
-import javax.servlet.jsp.PageContext;
 import java.util.HashMap;
 
 /**
@@ -35,16 +34,14 @@
         xhtml.put(INPUT_HIDDEN_TAG, new XhtmlRendering());
     }
 
-    public static class State extends AbstractHtmlState
+    public static class State extends AbstractHtmlDataSourceState
     {
-        public String name;
         public String value;
 
         public void clear()
         {
             super.clear();
 
-            name = null;
             value = null;
         }
     }

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputTextTag.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputTextTag.java?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputTextTag.java&r1=109510&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputTextTag.java&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputTextTag.java
       (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/InputTextTag.java
       Thu Dec  2 09:56:23 2004
@@ -36,7 +36,7 @@
         xhtml.put(INPUT_TEXT_TAG, new XhtmlRendering());
     }
 
-    public static class State extends AbstractHtmlState
+    public static class State extends AbstractHtmlDataSourceState
     {
         public String type;
         public boolean disabled;
@@ -44,8 +44,6 @@
         public int size;
         public String value;
         public boolean readonly;
-
-        public String name;
 
         public void clear()
         {

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/SelectTag.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/SelectTag.java?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/SelectTag.java&r1=109510&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/SelectTag.java&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/SelectTag.java
  (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/SelectTag.java
  Thu Dec  2 09:56:23 2004
@@ -35,9 +35,8 @@
         xhtml.put(SELECT_TAG, new XhtmlRendering());
     }
 
-    public static class State extends AbstractHtmlState
+    public static class State extends AbstractHtmlDataSourceState
     {
-        public String name;
         public boolean disabled;
         public boolean multiple;
         public int size;
@@ -45,7 +44,6 @@
         public void clear()
         {
             super.clear();
-            name = null;
             disabled = false;
             multiple = false;
             size = 0;

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java&r1=109510&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java
   (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java
   Thu Dec  2 09:56:23 2004
@@ -351,6 +351,11 @@
             return (TagRenderingBase) o;
         }
 
+        /**
+         * Return true if the current document is XHTML
+         * @param req
+         * @return
+         */
         public static boolean isXHTML(ServletRequest req)
         {
             Html html = (Html) req.getAttribute(Html.HTML_TAG_ID);

Modified: 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TextAreaTag.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TextAreaTag.java?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TextAreaTag.java&r1=109510&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TextAreaTag.java&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TextAreaTag.java
        (original)
+++ 
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/rendering/TextAreaTag.java
        Thu Dec  2 09:56:23 2004
@@ -35,13 +35,12 @@
         xhtml.put(TEXT_AREA_TAG, new XhtmlRendering());
     }
 
-    public static class State extends AbstractHtmlState
+    public static class State extends AbstractHtmlDataSourceState
     {
         public int rows;
         public int cols;
         public boolean readonly;
         public boolean disabled;
-        public String name;
 
         public void clear()
         {
@@ -50,7 +49,6 @@
             cols = 0;
             readonly = false;
             disabled = false;
-            name = null;
         }
     }
 

Modified: 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/cr183774.xml
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/cr183774.xml?view=diff&rev=109511&p1=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/cr183774.xml&r1=109510&p2=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/cr183774.xml&r2=109511
==============================================================================
--- 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/cr183774.xml  
    (original)
+++ 
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/cr183774.xml  
    Thu Dec  2 09:56:23 2004
@@ -1,92 +1,85 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
-<recorderSession 
xmlns="http://beehive.apache.org/netui/tools/testrecorder/2004/session";>
-
-  <sessionName>cr183774</sessionName>
-  <tester>Daryl</tester>
-  <startDate>26 May 2004, 11:39:16.400 AM MDT</startDate>
-  <description>Verify that tagId is written for Hidden</description>
-
-  <tests>
-  <test>
-    <testNumber>1</testNumber>
-
-    <request>
-
-      <protocol>HTTP</protocol>
-      <protocolVersion>1.1</protocolVersion>
-      <host>localhost</host>
-      <port>7001</port>
-      <uri>/coreWeb/bugs/cr183774/Controller.jpf</uri>
-      <method>GET</method>
-
-      <parameters>
-      </parameters>
-
-      <cookies>
-        <cookie>
-          <name>JSESSIONID</name>
-          
<value>A0Wr64j7PzRdfOFU8UkeJ9BIF6YFzQs2a0RDHp2Ap112P8VZ0RHb!-340733169</value>
-        </cookie>
-      </cookies>
-
-      <headers>
-        <header>
-          <name>Accept</name>
-          <value>image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, 
application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, 
application/x-shockwave-flash, */*</value>
-        </header>
-        <header>
-          <name>Accept-Encoding</name>
-          <value>gzip, deflate</value>
-        </header>
-        <header>
-          <name>Accept-Language</name>
-          <value>en-us</value>
-        </header>
-        <header>
-          <name>Connection</name>
-          <value>Keep-Alive</value>
-        </header>
-        <header>
-          <name>Cookie</name>
-          
<value>JSESSIONID=A0Wr64j7PzRdfOFU8UkeJ9BIF6YFzQs2a0RDHp2Ap112P8VZ0RHb!-340733169</value>
-        </header>
-        <header>
-          <name>Host</name>
-          <value>localhost:7001</value>
-        </header>
-        <header>
-          <name>User-Agent</name>
-          <value>Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)</value>
-        </header>
-      </headers>
-
-    </request>
-
-    <response>
-      <statusCode>200</statusCode>
-      <reason></reason>
-      <responseBody><![CDATA[<!DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 
Transitional//EN"
+<ses:recorderSession 
xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session";>
+   <ses:sessionName>Cr183774</ses:sessionName>
+   <ses:tester>Daryl</ses:tester>
+   <ses:startDate>02 Dec 2004, 08:03:55.138 AM MST</ses:startDate>
+   <ses:description>Daryl</ses:description>
+   <ses:tests>
+      <ses:test>
+         <ses:testNumber>1</ses:testNumber>
+         <ses:request>
+            <ses:protocol>HTTP</ses:protocol>
+            <ses:protocolVersion>1.1</ses:protocolVersion>
+            <ses:host>localhost</ses:host>
+            <ses:port>8080</ses:port>
+            <ses:uri>/coreWeb/bugs/cr183774/Controller.jpf</ses:uri>
+            <ses:method>GET</ses:method>
+            <ses:parameters/>
+            <ses:cookies>
+               <ses:cookie>
+                  <ses:name>JSESSIONID</ses:name>
+                  <ses:value>53CCBC14C91712D19F8038529D9E0367</ses:value>
+               </ses:cookie>
+            </ses:cookies>
+            <ses:headers>
+               <ses:header>
+                  <ses:name>accept</ses:name>
+                  <ses:value>image/gif, image/x-xbitmap, image/jpeg, 
image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, 
application/msword, application/x-shockwave-flash, */*</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>accept-encoding</ses:name>
+                  <ses:value>gzip, deflate</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>accept-language</ses:name>
+                  <ses:value>en-us</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>connection</ses:name>
+                  <ses:value>Keep-Alive</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>cookie</ses:name>
+                  <ses:value>$Version=0; 
JSESSIONID=53CCBC14C91712D19F8038529D9E0367; $Path=/coreWeb</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>host</ses:name>
+                  <ses:value>localhost:8080</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>testrecorder.playback.testid</ses:name>
+                  <ses:value>-5b08d1d5:100944b8a1e:-7e26</ses:value>
+               </ses:header>
+               <ses:header>
+                  <ses:name>user-agent</ses:name>
+                  <ses:value>Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 
5.1)</ses:value>
+               </ses:header>
+            </ses:headers>
+         </ses:request>
+         <ses:response>
+            <ses:statusCode>200</ses:statusCode>
+            <ses:reason/>
+            <ses:responseBody>&lt;!DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 
Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd";>
-<html lang="en">
+&lt;html lang="en">
 
-<head>
-        <base 
href="http://@NON_UNIQUE_HOST@:@NON_UNIQUE_PORT@/coreWeb/bugs/cr183774/index.jsp";>
-    </head>
-    <body>
-    <p style="color:#009900;">This test contains two hidden fields inside a 
form with the tagId attribute set.  The
+    &lt;head>
+        &lt;base href="http://localhost:8080/coreWeb/bugs/cr183774/index.jsp";>
+    &lt;/head>
+    &lt;body>
+    &lt;p style="color:#009900;">This test contains two hidden fields inside a 
form with the tagId attribute set.  The
     result should be an id attribute set in the resulting html.  No need to 
postback.
-    <hr>
-    <form name="fooForm" action="/coreWeb/bugs/cr183774/testAction.do" 
method="post">
-            <input type="hidden" id="barId" name="{actionForm.bar}" value="">
-            <input type="hidden" id="fooId" name="{actionForm.foo}" value="">
-            <input type="submit" value="TestAction">
-        </form>
-    </body>
+    &lt;hr>
+    &lt;form name="fooForm" action="/coreWeb/bugs/cr183774/testAction.do" 
method="post">
+            &lt;input type="hidden" name="{actionForm.bar}" value="">
+            &lt;input type="hidden" name="{actionForm.foo}" value="">
+            &lt;input type="submit" value="TestAction">
+        &lt;/form>
+    &lt;/body>
 
 
-<script language="JavaScript" type="text/JavaScript">
-<!--
+&lt;script language="JavaScript" type="text/JavaScript">
+&lt;!--
 
 // **** This section contains code that will run when the page is loaded ****
 
@@ -95,8 +88,8 @@
 // to the real id written into the HTML
 if (netui_names == null)
    var netui_names = new Object();
-netui_names.barId="barId"
-netui_names.fooId="fooId"
+netui_names.barId="{actionForm.bar}"
+netui_names.fooId="{actionForm.foo}"
 
 
 // **** This section contains functions typically run as events ****
@@ -125,17 +118,19 @@
    return getScopeId(tag.parentElement);
 }
 -->
-</script>
-
-
-</html>]]></responseBody>
-
-    </response>
-  </test>
-
-  </tests>
+&lt;/script>
 
-  <endDate>26 May 2004, 11:39:32.063 AM MDT</endDate>
-  <testCount>1</testCount>
 
-</recorderSession>
\ No newline at end of file
+&lt;/html></ses:responseBody>
+         </ses:response>
+         <ses:testResults>
+            <ses:testStatus>fail</ses:testStatus>
+         </ses:testResults>
+      </ses:test>
+   </ses:tests>
+   <ses:endDate>02 Dec 2004, 08:03:55.977 AM MST</ses:endDate>
+   <ses:sessionStatus>fail</ses:sessionStatus>
+   <ses:testCount>1</ses:testCount>
+   <ses:passedCount>0</ses:passedCount>
+   <ses:failedCount>1</ses:failedCount>
+</ses:recorderSession>
\ No newline at end of file

Reply via email to