Reputation:
In my struts 2.0.12 application I'm trying to use s:datetimepicker but it does not render.
Firebug error: dojo is not defined on dojo.require("dojo.widget.DatePicker");
My jsp page
<%@taglib prefix="s" uri="/struts-tags" %>
.
.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<s:head theme="ajax" debug="true"/>
.
.
</head>
<body>
.
.
<s:datetimepicker name="dataInizioRicerca" label="data inizio ricerca (yyyy-MM-dd)" displayFormat="yyyy-MM-dd"/>
.
.
</body>
What's wrong? Did I miss something?
Upvotes: 0
Views: 4663
Reputation: 11
You need to stop using struts dojo tags and use dojo independently. struts -dojo is not supported any more.
Upvotes: 0
Reputation: 1
I know it's a while since this thread was updated but if someone experiences the problem above and does a search they might end up here and the following observations may be useful.
I got similar issues when using Dojo with Struts 2.1 but that was down to the major changes in how struts 2 works with Dojo. A useful resource in sorting out those issues can be found here: Toubleshootng guide for migrating from Struts 2.0.x to Struts 2.1.x
If getting Dojo working was still causing problems you could try using the Struts 2 jquery plugin, (do a search for that as I am not allowed to post 2 hyperlinks)
Upvotes: 0
Reputation: 8054
Yes you missed the Ajax header (Ajax struts theme) tag.
This loads the Dojo Javascript files at the start of the page.
Put the following in your HTML head:
<head>
[..other stuff]
<s:head/> <!-- Struts 2 Ajax/Dojo needed for calendar -->
</head>
By the way - the above post talks about struts 2.1.x and not struts 2.0.12 (the one you are using)
Upvotes: 1
Reputation:
For use datetimepicker you need to use struts-dojo-tags, this came into de struts-dojo-plugin.jar of struts library, now u have the tags, loaded whit
and put inside head tag
to visualize the date time picker....
... maybe this can help you....
Upvotes: 1