Dojo Struts 2.0.12
In my struts 2.0.12 app, I try to use s: datetimepicker but it doesn't show up.
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 happened? Did I miss something?
Yes, you missed the Ajax title tag (Ajax struts tag).
Loads Dojo Javascript files at the top of the page.
Put the following in your head:
<head>
[..other stuff]
<s:head/> <!-- Struts 2 Ajax/Dojo needed for calendar -->
</head>
By the way, the above posts are talking about struts 2.1.x and not struts 2.0.12 (the one you are using)
source to share
I've known this for a while since this thread has been updated, but if anyone comes across the problem above and does a search, they might end up here and the following observations might be helpful.
I experienced similar issues when using Dojo with Struts 2.1, but this was due to major changes in how struts 2 works with Dojo. A useful resource when sorting out these issues can be found here: Toubleshootng Guide for Moving from Struts 2.0.x to Struts 2.1.x
If you were still having problems with Dojo, you could try using the jQuery Struts 2 plugin (do a search as I am not allowed to submit 2 hyperlinks)
source to share