mirror of
https://github.com/apache/struts.git
synced 2026-08-06 15:17:00 +00:00
Merge pull request #474 from kerttup/Branch_1
WW-2411 Add a maxlength attribute to the textarea tag
This commit is contained in:
@@ -51,6 +51,8 @@ public class TextArea extends UIBean {
|
||||
protected String readonly;
|
||||
protected String rows;
|
||||
protected String wrap;
|
||||
protected String maxlength;
|
||||
protected String minlength;
|
||||
|
||||
public TextArea(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
|
||||
super(stack, request, response);
|
||||
@@ -78,6 +80,13 @@ public class TextArea extends UIBean {
|
||||
if (wrap != null) {
|
||||
addParameter("wrap", findString(wrap));
|
||||
}
|
||||
|
||||
if (maxlength != null) {
|
||||
addParameter("maxlength", findString(maxlength));
|
||||
}
|
||||
if (minlength != null) {
|
||||
addParameter("minlength", findString(minlength));
|
||||
}
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="HTML cols attribute", type="Integer")
|
||||
@@ -99,4 +108,14 @@ public class TextArea extends UIBean {
|
||||
public void setWrap(String wrap) {
|
||||
this.wrap = wrap;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="HTML maxlength attribute", type="Integer")
|
||||
public void setMaxlength(String maxlength) {
|
||||
this.maxlength = maxlength;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="HTML minlength attribute", type="Integer")
|
||||
public void setMinlength(String minlength) {
|
||||
this.minlength = minlength;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@ public class TextareaTag extends AbstractUITag {
|
||||
protected String readonly;
|
||||
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);
|
||||
@@ -50,6 +52,8 @@ public class TextareaTag extends AbstractUITag {
|
||||
textArea.setReadonly(readonly);
|
||||
textArea.setRows(rows);
|
||||
textArea.setWrap(wrap);
|
||||
textArea.setMaxlength(maxlength);
|
||||
textArea.setMinlength(minlength);
|
||||
}
|
||||
|
||||
public void setCols(String cols) {
|
||||
@@ -67,5 +71,13 @@ public class TextareaTag extends AbstractUITag {
|
||||
public void setWrap(String wrap) {
|
||||
this.wrap = wrap;
|
||||
}
|
||||
|
||||
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>
|
||||
@@ -133,6 +133,14 @@
|
||||
<td align="left" valign="top">String</td>
|
||||
<td align="left" valign="top">Define label position of form element (top/left)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="top">maxlength</td>
|
||||
<td align="left" valign="top">false</td>
|
||||
<td align="left" valign="top"></td>
|
||||
<td align="left" valign="top">false</td>
|
||||
<td align="left" valign="top">Integer</td>
|
||||
<td align="left" valign="top">HTML maxlength attribute</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="top">name</td>
|
||||
<td align="left" valign="top">false</td>
|
||||
|
||||
Reference in New Issue
Block a user