com.opensymphony.webwork.components.TextField Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of webwork Show documentation
Show all versions of webwork Show documentation
WebWork is a Java web-application development framework.
It is built specifically with developer productivity and
code simplicity in mind, providing robust support for building
reusable UI templates, such as form controls, UI themes,
internationalization, dynamic form parameter mapping to JavaBeans,
robust client and server side validation, and much more.
The newest version!
package com.opensymphony.webwork.components;
import com.opensymphony.xwork.util.OgnlValueStack;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* Render an HTML input field of type text
*
*
* Examples
*
*
* In this example, a text control is rendered. The label is retrieved from a ResourceBundle by calling
* ActionSupport's getText() method.
*
*
*
* <ww:textfield label="%{text('user_name')}" name="user" />
*
*
*
* @author Patrick Lightbody
* @author Rene Gielen
* @version $Revision: 2468 $
* @since 2.2
*
* @ww.tag name="textfield" tld-body-content="JSP" tld-tag-class="com.opensymphony.webwork.views.jsp.ui.TextFieldTag"
* description="Render an HTML input field of type text"
*/
public class TextField extends UIBean {
/**
* The name of the default template for the TextFieldTag
*/
final public static String TEMPLATE = "text";
protected String maxlength;
protected String readonly;
protected String size;
public TextField(OgnlValueStack stack, HttpServletRequest request, HttpServletResponse response) {
super(stack, request, response);
}
protected String getDefaultTemplate() {
return TEMPLATE;
}
protected void evaluateExtraParams() {
super.evaluateExtraParams();
if (size != null) {
addParameter("size", findString(size));
}
if (maxlength != null) {
addParameter("maxlength", findString(maxlength));
}
if (readonly != null) {
addParameter("readonly", findValue(readonly, Boolean.class));
}
}
/**
* HTML maxlength attribute
* @ww.tagattribute required="false" type="Integer"
*/
public void setMaxlength(String maxlength) {
this.maxlength = maxlength;
}
/**
* Deprecated. Use maxlength instead.
* @ww.tagattribute required="false"
*/
public void setMaxLength(String maxlength) {
this.maxlength = maxlength;
}
/**
* Whether the input is readonly
* @ww.tagattribute required="false" type="Boolean" default="false"
*/
public void setReadonly(String readonly) {
this.readonly = readonly;
}
/**
* HTML size attribute
* @ww.tagattribute required="false" type="Integer"
*/
public void setSize(String size) {
this.size = size;
}
}