How do I set a Date to a javascript object, using Java?

I am using Java and Eclipse. For one part of my project, I needed to write a calendar, so I decided to use already written (on javascript) callendar - http://xdsoft.net/jqplugins/datetimepicker/

I have written a method that initialize the js component:

private static native void initComponent()/*-{
        $wnd.$('#datetimepickerStart').datetimepicker();
        $wnd.$('#datetimepickerEnd').datetimepicker({
                                            value:'29.06.2015',
                                            format:'d.m.Y.H:i'});
    }-*/;

The problem is that I dont know how to populate the date. I tried something like:

private static native void setStartDate(Date date)/*-{
        $wnd.$('#datetimepickerStart').datetimepicker({
                                            value:date,
                                            format:'d.m.Y.H:i'});
    }-*/;

But it didnt work.

Can I have some suggestions: what I have did right/wrong, what to google?

Answers


You can't use another programming language just inline in the Java code. Despite it's name, JavaScript has not much in common with Java.

If you really want to integrate both, you could do so using the Java Scripting API but that is going to be tough.


Need Your Help

Pure Data for music composition?

generator hidden-markov-models puredata

I am currently working on a project where a Classical Music Generator is set to be built. A lecturer who is pretty much a expert in sound processing suggested that I could construct a Hidden Markov...

tomcat isolate webapps

java tomcat jvm

multiple webapp running on same tomcat using same jvm. sometime, one webapp that have memory leak will cause entire jvm to crash and affect other webapps. any recommendation how to isolated that wi...