aspose file tools*
The moose likes Struts and the fly likes Struts 2: datetimepicker tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2: datetimepicker tag" Watch "Struts 2: datetimepicker tag" New topic
Author

Struts 2: datetimepicker tag

Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8710
    
    6

I see the Dojo plugin is or will be deprecated. I need a date picker for an app I'm writing. Should I use the datetimepicker tag or look elsewhere?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Meh: personally, I'd look elsewhere. I'm not sure if they're doing a date/time thing for the new jQuery plugin, though--if they are, I'd consider that since it's likely to be supported for some time. (See [1])

As a personal preference, I do all my JavaScript "raw" since taglibs have a tendency to scatter JavaScript throughout the page and take away my ability to control it.

[1] We really just got rid of the Dojo tags because the Dojo API changed so much between 0.4.3 and 1.0 and the amount of work was a bit overwhelming.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8710
    
    6

Have you tried the jQuery plugin? I can't get it to work. I dropped the struts2-jquery-plugin-1.7.3.jar into my WEB-INF/lib directory and added a date picker to my JSP page:


When the page loads, I get a Javascript error:


Googling for "$elem.datepicker is not a function" returns no hits. Any ideas?>
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I was talking about the official Struts 2 jQuery plugin (currently in the sandbox, maybe?) and I don't know which, if any, widgets it includes out-of-the-box.

I do, however, believe that the plugin you're talking about has a "jqueryui" attribute that needs to be set for the datepicker to work, if I'm reading the example correctly:I might be misunderstanding what that attribute does, though.

Edit: Based on the info here, I'd say I'm guessing right.

But to answer your question, no, I haven't used it.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8710
    
    6

David Newton wrote:I was talking about the official Struts 2 jQuery plugin (currently in the sandbox, maybe?) and I don't know which, if any, widgets it includes out-of-the-box.


Ah, I just searched for "struts 2 jquery plugin" and picked the first one that came up. It appears to be the same one in the Struts 2 Wiki. Am I looking in the wrong place?

David Newton wrote:I do, however, believe that the plugin you're talking about has a "jqueryui" attribute that needs to be set for the datepicker to work, i


That did the trick. You saved my day!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Woohoo!

Well, the official one is still only quasi-official (that may have changed--I've been out-of-the-loop for the last couple of months). IIRC some of the features of the Google code one are being baked in to the official release, but I'm not sure. The struts-user list would be the best place to look for info about all that.
 
jQuery in Action, 2nd edition
 
subject: Struts 2: datetimepicker tag
 
Similar Threads
datetimepicker in struts2
issue with datetimepicker & autocompleter in struts 2
Struts 2 - DateTimePicker
autocompleter and datetimepicker not working in Struts 2
datetimepicker