Save This Page
Home » struts- » org.apache.struts2.dojo » components » [javadoc | source]
public class: DateTimePicker [javadoc | source]

Renders a date/time picker in a dropdown container.

A stand-alone DateTimePicker widget that makes it easy to select a date/time, or increment by week, month, and/or year.

It is possible to customize the user-visible formatting with either the 'formatLength' (long, short, medium or full) or 'displayFormat' attributes. By defaulty current locale will be used.

Syntax supported by 'displayFormat' is (
Format Description
d Day of the month
D Day of year
M Month - Use one or two for the numerical month, three for the abbreviation, or four for the full name, or 5 for the narrow name.
y Year
h Hour [1-12].
H Hour [0-23].
m Minute. Use one or two for zero padding.
s Second. Use one or two for zero padding.

The value sent to the server is a locale-independent value, in a hidden field as defined by the name attribute. The value will be formatted conforming to RFC3 339 (yyyy-MM-dd'T'HH:mm:ss)

The following formats(in order) will be used to parse the values of the attributes 'value', 'startDate' and 'endDate':


  <sx:datetimepicker name="" label="Order Date" />
  <sx:datetimepicker name="" label="Delivery Date" displayFormat="yyyy-MM-dd"  />
  <sx:datetimepicker name="" label="Delivery Date" value="%{date}"  />
  <sx:datetimepicker name="" label="Delivery Date" value="%{'2007-01-01'}"  />
  <sx:datetimepicker name="" label="Order Date" value="%{'today'}"/>

<sx:datetimepicker id="picker" label="Order Date" /> <script type="text/javascript"> function setValue() { var picker = dojo.widget.byId("picker"); //string value picker.setValue('2007-01-01'); //Date value picker.setValue(new Date()); } function showValue() { var picker = dojo.widget.byId("picker"); //string value var stringValue = picker.getValue(); alert(stringValue); //date value var dateValue = picker.getDate(); alert(dateValue); } </script> <sx:datetimepicker id="picker" label="Order Date" valueNotifyTopics="/value"/> <script type="text/javascript"> dojo.event.topic.subscribe("/value", function(textEntered, date, widget){ alert('value changed'); //textEntered: String enetered in the textbox //date: JavaScript Date object with the value selected //widet: widget that published the topic }); </script>
Field Summary
public static final  String TEMPLATE     
protected static final  Logger LOG     
protected  String iconPath     
protected  String formatLength     
protected  String displayFormat     
protected  String toggleType     
protected  String toggleDuration     
protected  String type     
protected  String displayWeeks     
protected  String adjustWeeks     
protected  String startDate     
protected  String endDate     
protected  String weekStartsOn     
protected  String staticDisplay     
protected  String dayWidth     
protected  String language     
protected  String templateCssPath     
protected  String valueNotifyTopics     
Fields inherited from org.apache.struts2.components.UIBean:
request,  response,  templateSuffix,  template,  templateDir,  theme,  key,  id,  cssClass,  cssStyle,  cssErrorClass,  cssErrorStyle,  disabled,  label,  labelPosition,  labelSeparator,  requiredposition,  name,  required,  tabindex,  value,  title,  onclick,  ondblclick,  onmousedown,  onmouseup,  onmouseover,  onmousemove,  onmouseout,  onfocus,  onblur,  onkeypress,  onkeydown,  onkeyup,  onselect,  onchange,  accesskey,  tooltip,  tooltipConfig,  javascriptTooltip,  tooltipDelay,  tooltipCssClass,  tooltipIconPath,  dynamicAttributes,  defaultTemplateDir,  defaultUITheme,  templateEngineManager
Fields inherited from org.apache.struts2.components.Component:
COMPONENT_STACK,  stack,  parameters,  actionMapper,  throwExceptionOnELFailure
 public DateTimePicker(ValueStack stack,
    HttpServletRequest request,
    HttpServletResponse response) 
Method from org.apache.struts2.dojo.components.DateTimePicker Summary:
evaluateParams,   getDefaultTemplate,   getTheme,   setAdjustWeeks,   setDayWidth,   setDisplayFormat,   setDisplayWeeks,   setEndDate,   setFormatLength,   setIconPath,   setLanguage,   setStartDate,   setStaticDisplay,   setTemplateCssPath,   setTheme,   setToggleDuration,   setToggleType,   setType,   setValue,   setValueNotifyTopics,   setWeekStartsOn
Methods from org.apache.struts2.components.UIBean:
addFormParameter,   buildTemplateName,   enableAncestorFormCustomOnsubmit,   end,   ensureAttributeSafelyNotEscaped,   escape,   evaluateExtraParams,   evaluateNameValue,   evaluateParams,   getDefaultTemplate,   getId,   getTemplate,   getTemplateDir,   getTheme,   getTooltipConfig,   getValueClassType,   mergeTemplate,   populateComponentHtmlId,   setAccesskey,   setCssClass,   setCssErrorClass,   setCssErrorStyle,   setCssStyle,   setDefaultTemplateDir,   setDefaultUITheme,   setDisabled,   setDynamicAttributes,   setId,   setJavascriptTooltip,   setKey,   setLabel,   setLabelSeparator,   setLabelposition,   setName,   setOnblur,   setOnchange,   setOnclick,   setOndblclick,   setOnfocus,   setOnkeydown,   setOnkeypress,   setOnkeyup,   setOnmousedown,   setOnmousemove,   setOnmouseout,   setOnmouseover,   setOnmouseup,   setOnselect,   setRequired,   setRequiredposition,   setTabindex,   setTemplate,   setTemplateDir,   setTemplateEngineManager,   setTheme,   setTitle,   setTooltip,   setTooltipConfig,   setTooltipCssClass,   setTooltipDelay,   setTooltipIconPath,   setValue
Methods from org.apache.struts2.components.Component:
addAllParameters,   addParameter,   altSyntax,   altSyntax,   completeExpressionIfAltSyntax,   copyParams,   determineActionURL,   determineNamespace,   end,   end,   fieldError,   findAncestor,   findString,   findString,   findStringIfAltSyntax,   findValue,   findValue,   findValue,   getComponentStack,   getParameters,   getStack,   popComponentStack,   setActionMapper,   setThrowExceptionsOnELFailure,   start,   stripExpressionIfAltSyntax,   stripExpressionIfAltSyntax,   toString,   usesBody
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.struts2.dojo.components.DateTimePicker Detail:
 public  void evaluateParams() 
 protected String getDefaultTemplate() 
 public String getTheme() 
 public  void setAdjustWeeks(String adjustWeeks) 
 public  void setDayWidth(String dayWidth) 
 public  void setDisplayFormat(String displayFormat) 
 public  void setDisplayWeeks(String displayWeeks) 
 public  void setEndDate(String endDate) 
 public  void setFormatLength(String formatLength) 
 public  void setIconPath(String iconPath) 
 public  void setLanguage(String language) 
 public  void setStartDate(String startDate) 
 public  void setStaticDisplay(String staticDisplay) 
 public  void setTemplateCssPath(String templateCssPath) 
 public  void setTheme(String theme) 
 public  void setToggleDuration(String toggleDuration) 
 public  void setToggleType(String toggleType) 
 public  void setType(String type) 
 public  void setValue(String arg0) 
 public  void setValueNotifyTopics(String valueNotifyTopics) 
 public  void setWeekStartsOn(String weekStartsOn)