org.apache.struts2.components
Class DatePicker

java.lang.Object
  extended by org.apache.struts2.components.Component
      extended by org.apache.struts2.components.UIBean
          extended by org.apache.struts2.components.TextField
              extended by org.apache.struts2.components.DatePicker

public class DatePicker
extends TextField

Renders datepicker element.

Format supported by this component are:-
Format Description
#dd Display day in two digits format
#d Try to display day in one digit format, if cannot use 2 digit format
#MM Display month in two digits format
#M Try to display month in one digits format, if cannot use 2 digit format
#yyyy Display year in four digits format
#yy Display the last two digits of the yaer
#y Display the last digits of the year

Examples

 

 Example 1:
     <s:datepicker name="order.date" label="Order Date" />
 Example 2:
     <s:datepicker name="delivery.date" label="Delivery Date" format="#yyyy-#MM-#dd"  />
     
 
 

The css could be changed by using the following :-

 
 
 <s:datepicker name="birthday" label="Birthday" templateCss="...." />
 
 
 


Field Summary
protected  java.lang.String dateIconPath
           
protected  java.lang.String format
           
protected  java.lang.String size
           
static java.lang.String TEMPLATE
           
protected  java.lang.String templateCssPath
           
protected  java.lang.String templatePath
           
 
Fields inherited from class org.apache.struts2.components.TextField
maxlength, readonly
 
Fields inherited from class org.apache.struts2.components.UIBean
accesskey, cssClass, cssStyle, disabled, label, labelPosition, name, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, request, required, requiredposition, response, tabindex, template, templateDir, templateSuffix, theme, title, tooltip, tooltipConfig, value
 
Fields inherited from class org.apache.struts2.components.Component
COMPONENT_STACK, id, parameters, stack
 
Constructor Summary
DatePicker(com.opensymphony.xwork2.util.OgnlValueStack stack, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Method Summary
 void evaluateParams()
           
protected  java.lang.String getDefaultTemplate()
          A contract that requires each concrete UI Tag to specify which template should be used as a default.
 void setDateIconPath(java.lang.String dateIconPath)
          The date picker icon path
 void setFormat(java.lang.String format)
          The format to use for date field.
 void setSize(java.lang.String size)
          The datepicker text field size.
 void setTemplateCssPath(java.lang.String templateCssPath)
          The datepicker template css path.
 void setTemplatePath(java.lang.String templatePath)
          The datepicker template path.
 
Methods inherited from class org.apache.struts2.components.TextField
evaluateExtraParams, setMaxlength, setMaxLength, setReadonly
 
Methods inherited from class org.apache.struts2.components.UIBean
addFormParameter, buildTemplateName, enableAncestorFormCustomOnsubmit, end, escape, evaluateNameValue, getTemplate, getTemplateDir, getTheme, getTooltipConfig, getValueClassType, mergeTemplate, populateComponentHtmlId, setAccesskey, setCssClass, setCssStyle, setDisabled, setLabel, setLabelposition, setName, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setRequired, setRequiredposition, setTabindex, setTemplate, setTemplateDir, setTheme, setTitle, setTooltip, setTooltipConfig, setValue
 
Methods inherited from class org.apache.struts2.components.Component
addAllParameters, addParameter, altSyntax, copyParams, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findValue, findValue, findValue, getComponentStack, getId, getParameters, getStack, popComponentStack, setId, start, toString, usesBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMPLATE

public static final java.lang.String TEMPLATE
See Also:
Constant Field Values

format

protected java.lang.String format

dateIconPath

protected java.lang.String dateIconPath

templatePath

protected java.lang.String templatePath

templateCssPath

protected java.lang.String templateCssPath

size

protected java.lang.String size
Constructor Detail

DatePicker

public DatePicker(com.opensymphony.xwork2.util.OgnlValueStack stack,
                  javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
Method Detail

getDefaultTemplate

protected java.lang.String getDefaultTemplate()
Description copied from class: UIBean
A contract that requires each concrete UI Tag to specify which template should be used as a default. For example, the CheckboxTab might return "checkbox.vm" while the RadioTag might return "radio.vm". This value not begin with a '/' unless you intend to make the path absolute rather than relative to the current theme.

Overrides:
getDefaultTemplate in class TextField
Returns:
The name of the template to be used as the default.

evaluateParams

public void evaluateParams()
Overrides:
evaluateParams in class UIBean

setFormat

public void setFormat(java.lang.String format)
The format to use for date field.


setDateIconPath

public void setDateIconPath(java.lang.String dateIconPath)
The date picker icon path


setTemplatePath

public void setTemplatePath(java.lang.String templatePath)
The datepicker template path.


setTemplateCssPath

public void setTemplateCssPath(java.lang.String templateCssPath)
The datepicker template css path.


setSize

public void setSize(java.lang.String size)
The datepicker text field size.

Overrides:
setSize in class TextField


Copyright © 2000-2006 Apache Software Foundation. All Rights Reserved.