You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by ni...@apache.org on 2005/11/06 02:29:12 UTC
svn commit: r331056 - in /struts/core/branches/STRUTS_1_2_BRANCH:
src/share/org/apache/struts/taglib/html/FormTag.java
web/test/test/org/apache/struts/taglib/html/TestFormTag1.jsp
Author: niallp
Date: Sat Nov 5 17:29:01 2005
New Revision: 331056
URL: http://svn.apache.org/viewcvs?rev=331056&view=rev
Log:
Port change for Bug 35127 to 1.2.x branch
Modified:
struts/core/branches/STRUTS_1_2_BRANCH/src/share/org/apache/struts/taglib/html/FormTag.java
struts/core/branches/STRUTS_1_2_BRANCH/web/test/test/org/apache/struts/taglib/html/TestFormTag1.jsp
Modified: struts/core/branches/STRUTS_1_2_BRANCH/src/share/org/apache/struts/taglib/html/FormTag.java
URL: http://svn.apache.org/viewcvs/struts/core/branches/STRUTS_1_2_BRANCH/src/share/org/apache/struts/taglib/html/FormTag.java?rev=331056&r1=331055&r2=331056&view=diff
==============================================================================
--- struts/core/branches/STRUTS_1_2_BRANCH/src/share/org/apache/struts/taglib/html/FormTag.java (original)
+++ struts/core/branches/STRUTS_1_2_BRANCH/src/share/org/apache/struts/taglib/html/FormTag.java Sat Nov 5 17:29:01 2005
@@ -501,9 +501,8 @@
StringBuffer results = new StringBuffer("<form");
// render attributes
- if (!this.isXhtml()) {
- renderName(results);
- }
+ renderName(results);
+
renderAttribute(results, "method", getMethod() == null ? "post" : getMethod());
renderAction(results);
renderAttribute(results, "accept-charset", getAcceptCharset());
@@ -512,7 +511,6 @@
renderAttribute(results, "onreset", getOnreset());
renderAttribute(results, "onsubmit", getOnsubmit());
renderAttribute(results, "style", getStyle());
- renderAttribute(results, "id", getStyleId());
renderAttribute(results, "target", getTarget());
// Hook for additional attributes
@@ -523,12 +521,20 @@
}
/**
- * Renders the name attribute
+ * Renders the name of the form. If XHTML is set to true, the name will
+ * be rendered as an 'id' attribute, otherwise as a 'name' attribute.
*/
protected void renderName(StringBuffer results) {
- results.append(" name=\"");
- results.append(beanName);
- results.append("\"");
+ if (this.isXhtml()) {
+ if (getStyleId() == null) {
+ renderAttribute(results, "id", beanName);
+ } else {
+ renderAttribute(results, "id", getStyleId());
+ }
+ } else {
+ renderAttribute(results, "name", beanName);
+ renderAttribute(results, "id", getStyleId());
+ }
}
/**
Modified: struts/core/branches/STRUTS_1_2_BRANCH/web/test/test/org/apache/struts/taglib/html/TestFormTag1.jsp
URL: http://svn.apache.org/viewcvs/struts/core/branches/STRUTS_1_2_BRANCH/web/test/test/org/apache/struts/taglib/html/TestFormTag1.jsp?rev=331056&r1=331055&r2=331056&view=diff
==============================================================================
--- struts/core/branches/STRUTS_1_2_BRANCH/web/test/test/org/apache/struts/taglib/html/TestFormTag1.jsp (original)
+++ struts/core/branches/STRUTS_1_2_BRANCH/web/test/test/org/apache/struts/taglib/html/TestFormTag1.jsp Sat Nov 5 17:29:01 2005
@@ -201,7 +201,7 @@
</html:form>
</bean:define>
<bean:define id="EXPECTED_RESULTS" toScope="page">
- <form name="testFormBean" method="misc" action="<%=response.encodeURL( request.getContextPath() + "/testFormTag.do")%>" id="id.goes.here">
+ <form name="testFormBean" id="id.goes.here" method="misc" action="<%=response.encodeURL( request.getContextPath() + "/testFormTag.do")%>">
</form>
</bean:define>
</logic:equal>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org