views:

851

answers:

3

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" %> . . . . . . . .

What's wrong? Did I miss something?

+1  A: 

hi....

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

<%@taglib prefix="sx" uri="/struts-dojo-tags"%>

and put inside head tag

to visualize the date time picker....

... maybe this can help you....

if its on struts 2.1
Kamia
+1  A: 

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)

kazanaki
A: 

Hi,

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)

lynchna