Frameworks| Hibernate| Struts| JSF| JavaFX| Ajax| Spring| DOJO| JDO| iBatis| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Datetimepicker Tag (Form Tag) Example 
 

In this section, we are going to describe the datetimepicker tag . The datetimepicker tag is a UI tag that is used to render a date/time picker in a dropdown container.

 

Datetimepicker Tag (Form Tag) Example

                         

In this section, we are going to describe the datetimepicker tag. The datetimepicker tag is a UI tag that is used to render 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 default current locale will be used.

Add the following code snippet into the struts.xml file.
struts.xml

<action name="datetimepickerTag" class="net.roseindia.includeTag">
       <result>/pages/uiTags/datetimepickerTag.jsp</result>
</action>

Create an action class as shown:  

includeTag.java

package net.roseindia;
import com.opensymphony.xwork2.ActionSupport;
import java.util.*;

public class includeTag extends ActionSupport {
  private Date myBirthday;
  public String execute() throws Exception{
    setMyBirthday(new Date("Jan 12, 1984 11:21:30 AM"));
    return SUCCESS;
  }
  public void setMyBirthday(Date date){
    this.myBirthday = date;
  }
  public Date getMyBirthday(){
    return myBirthday;
  }
}

Create a jsp using the tag <s:datetimepicker> 
This tag renders a date/time picker in a dropdown container.

The tag <s:datetimepicker name="myBirthday" label="My Birth Day (dd-MM-yyyy)" displayFormat="dd-MM-yyyy" /> picks the data from the action class "includeTag" using the parameter name="myBirthday" using the display format as  displayFormat="dd-MM-yyyy".

datetimepickerTag.jsp

<%taglib prefix="s" uri="/struts-tags" %>

<html>
  <head> 
    <title>Datetimepicker (Form TagTag Example!</title>
    <link href="<s:url value="/css/main.css"/>" rel="stylesheet"
          type="text/css"/>

      <s:head theme="ajax" />
  </head>
  <body>
    <h1><span style="background-color: #FFFFcc">Datetimepicker 
                                Tag Example!</span></h1>

    <s:datetimepicker name="myBirthday" label="My Birth Day 
                 (dd-MM-yyyy)" displayFormat="dd-MM-yyyy" />  
  
  </body>
</html>

Output of the datetimepickerTag.jsp:

                         

» View all related tutorials
Related Tags: html text ui sed textarea tag tar render tex to ext e area use ml m end s at htm

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

13 comments so far (
post your own) View All Comments Latest 10 Comments:

How to prevent user entering value in datetimepicker textbox.

Posted by Sumit on Sunday, 12.21.08 @ 10:06am | #83015

Hi,

I have une jsp page with a list of datetimepicker. When I submit the form, there is an offset (lag) in array.

Date[0] => Date[3]
Date[1] => Date[0]
Date[2] => Date[1]
etc...

I don't know why...

Does anyone had this problem?
How can I resolved?

Thanks in advance
Giuseppe

Posted by Giuseppe on Wednesday, 04.16.08 @ 16:27pm | #56702

<s:file --here goes the attributes you want--></s:file>

Posted by Kiran Thankaraj on Tuesday, 03.25.08 @ 12:26pm | #54240

hello I want to know how to get its values by javascript.
can you help me

Posted by opensky on Thursday, 03.20.08 @ 14:59pm | #53465

I am trying to change the size of my datetimepicker, but requiredPosition attribute doesnt help, and also want to increase its size.
Any suggestions?

Posted by Divs on Sunday, 02.10.08 @ 00:51am | #47727

I am trying to change the size of my datetimepicker, but requiredPosition attribute doesnt help, and also want to increase its size.
Any suggestions?

Posted by Divs on Sunday, 02.10.08 @ 00:37am | #47725

The tutorial is very helpful

Posted by Prem on Monday, 12.17.07 @ 23:45pm | #42753

How can i disable all the dates prior to today's date? i dont want any past dates to be picked. If there is any way, please let me know.

Thanks and Regsrds,
Swadesh

Posted by Swadesh on Wednesday, 12.12.07 @ 16:38pm | #41945

Struts2NewUser,

Yuo need to add the tag : <s:head/> in your <head></head> section, so that dojo libraries will be included correctly

Regards

Posted by bobsinglar on Wednesday, 11.21.07 @ 20:19pm | #38205

I followed the instruction above, however, it only renders labels. Do I need to setup anything for this to work?
thanks,

Posted by strutsNewUser on Tuesday, 09.25.07 @ 20:32pm | #29329

Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.