mirror of
https://github.com/apache/struts.git
synced 2026-08-06 15:17:00 +00:00
Adding minlength attribute to TextArea tag
also update of textare.ftl
This commit is contained in:
@@ -52,6 +52,7 @@ public class TextArea extends UIBean {
|
||||
protected String rows;
|
||||
protected String wrap;
|
||||
protected String maxlength;
|
||||
protected String minlength;
|
||||
|
||||
public TextArea(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
|
||||
super(stack, request, response);
|
||||
@@ -83,6 +84,9 @@ public class TextArea extends UIBean {
|
||||
if (maxlength != null) {
|
||||
addParameter("maxlength", findString(maxlength));
|
||||
}
|
||||
if (minlength != null) {
|
||||
addParameter("minlength", findString(minlength));
|
||||
}
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="HTML cols attribute", type="Integer")
|
||||
@@ -109,4 +113,9 @@ public class TextArea extends UIBean {
|
||||
public void setMaxlength(String maxlength) {
|
||||
this.maxlength = maxlength;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="HTML minlength attribute", type="Integer")
|
||||
public void setMinlength(String minlength) {
|
||||
this.minlength = minlength;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ public class TextareaTag extends AbstractUITag {
|
||||
protected String rows;
|
||||
protected String wrap;
|
||||
protected String maxlength;
|
||||
protected String minlength;
|
||||
|
||||
public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
|
||||
return new TextArea(stack, req, res);
|
||||
@@ -52,6 +53,7 @@ public class TextareaTag extends AbstractUITag {
|
||||
textArea.setRows(rows);
|
||||
textArea.setWrap(wrap);
|
||||
textArea.setMaxlength(maxlength);
|
||||
textArea.setMinlength(minlength);
|
||||
}
|
||||
|
||||
public void setCols(String cols) {
|
||||
@@ -72,6 +74,10 @@ public class TextareaTag extends AbstractUITag {
|
||||
|
||||
public void setMaxlength(String maxlength) {
|
||||
this.maxlength = maxlength;
|
||||
}
|
||||
}
|
||||
|
||||
public void setMinlength(String minlength) {
|
||||
this.minlength = minlength;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,4 +52,10 @@
|
||||
<#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>
|
||||
Reference in New Issue
Block a user