You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2022/06/15 12:49:10 UTC

[struts] branch WW-5191-textarea-max-length created (now 75ea7709e)

This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch WW-5191-textarea-max-length
in repository https://gitbox.apache.org/repos/asf/struts.git


      at 75ea7709e WW-5191 Fixes placement of maxLength and minLength attributes in <s:textarea/> tag

This branch includes the following new commits:

     new 75ea7709e WW-5191 Fixes placement of maxLength and minLength attributes in <s:textarea/> tag

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[struts] 01/01: WW-5191 Fixes placement of maxLength and minLength attributes in tag

Posted by lu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch WW-5191-textarea-max-length
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 75ea7709e7bb074cfebaeec81500e100d47405ce
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Wed Jun 15 14:49:02 2022 +0200

    WW-5191 Fixes placement of maxLength and minLength attributes in <s:textarea/> tag
---
 core/src/main/resources/template/simple/textarea.ftl       | 14 +++++++-------
 .../java/org/apache/struts2/views/jsp/ui/TextareaTest.java |  2 ++
 .../org/apache/struts2/views/jsp/ui/Textarea-1.txt         |  2 +-
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/core/src/main/resources/template/simple/textarea.ftl b/core/src/main/resources/template/simple/textarea.ftl
index f08826f1e..b3f653ced 100644
--- a/core/src/main/resources/template/simple/textarea.ftl
+++ b/core/src/main/resources/template/simple/textarea.ftl
@@ -45,6 +45,12 @@
 <#if parameters.title?has_content>
  title="${parameters.title}"<#rt/>
 </#if>
+<#if parameters.maxlength?has_content>
+ maxlength="${parameters.maxlength}"<#rt/>
+</#if>
+<#if parameters.minlength?has_content>
+ minlength="${parameters.minlength}"<#rt/>
+</#if>
 <#include "/${parameters.templateDir}/${parameters.expandTheme}/scripting-events.ftl" />
 <#include "/${parameters.templateDir}/${parameters.expandTheme}/common-attributes.ftl" />
 <#include "/${parameters.templateDir}/${parameters.expandTheme}/dynamic-attributes.ftl" />
@@ -52,10 +58,4 @@
 <#if parameters.nameValue??>
 <@s.property value="parameters.nameValue"/><#t/>
 </#if>
-<#if parameters.maxlength?has_content>
- maxlength="${parameters.maxlength}"<#rt/>
-</#if>
-<#if parameters.minlength?has_content>
- minlength="${parameters.minlength}"<#rt/>
-</#if>
-</textarea>
\ No newline at end of file
+</textarea>
diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/TextareaTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/TextareaTest.java
index d94bbd2c5..c311f9934 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/ui/TextareaTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/TextareaTest.java
@@ -47,6 +47,8 @@ public class TextareaTest extends AbstractUITagTest {
         tag.setId("the_id");
         tag.setOnkeyup("alert('hello');");
         tag.setReadonly("true");
+        tag.setMaxlength("100");
+        tag.setMinlength("10");
 
         tag.doStartTag();
         tag.doEndTag();
diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textarea-1.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textarea-1.txt
index 3b6fe998c..c40a1160d 100644
--- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textarea-1.txt
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textarea-1.txt
@@ -1,4 +1,4 @@
 <tr>
     <td class="tdLabel"><label for="the_id" class="label">mylabel:</label></td>
-    <td class="tdInput"><textarea name="myname" cols="20" rows="30" disabled="disabled" readonly="readonly" tabindex="5" id="the_id" title="mytitle" onclick="alert('onclick');" onkeyup="alert('hello');" onchange="alert('goodbye');">bar</textarea></td>
+    <td class="tdInput"><textarea name="myname" cols="20" rows="30" disabled="disabled" readonly="readonly" tabindex="5" id="the_id" title="mytitle" maxlength="100" minlength="10" onclick="alert('onclick');" onkeyup="alert('hello');" onchange="alert('goodbye');">bar</textarea></td>
 </tr>