how to use jmaki widgets for my application

hello

I'm using jmaki dojo.dropdown datepicker for my application but to insert the date value into database i want to take into some string variable. Can anybody please help me how to use for my application.

[230 byte] By [nikhil@cetharsoft.coma] at [2007-11-27 11:38:27]
# 1

You can add the following fragment to glue.js:

-- cut here --

jmaki.subscribe("/dojo/dropdownDatePicker", dateListener);

function dateListener(item) {

var targetDiv = document.getElementById("newpage");

targetDiv.innerHTML = item.value;

}

-- cut here --

and following to the main body of index.jsp:

-- cut here --

<div id="newpage"></div>

-- cut here --

This will print the value of selected date on your page. Basically, dojo.dropdown datepicker publishes message whenever it's state change to a topic. In the code above, we are subscribing to that topic, extracting the value and then dumping it on the page. You can certainly use the value for any other purpose. More details about this are available at:

http://blogs.sun.com/arungupta/entry/jmaki_publish_subscribe_and_debugging

I'm working on a more detailed entry with a complete code sample.

Arun.Guptaa at 2007-7-29 17:20:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

sir

Thanks for ur guidance but my problem doesn't get solved.

My requirement is the date i choose to take in string variable for inserting it into a database & i have to two datefields on my form so i'm using two dropdown date pickers; so how can i pass selected dates into database & i'm inserting the data through servlet. What procedure i should follow please gude me.

nikhil@cetharsoft.coma at 2007-7-29 17:20:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

You can replace dateListener function with:

-- cut here --

jmaki.doAjax( url : 'foo.jsp?datePicker=' + item.value,

callback : function(req) {

alert("back with " + req.responseText);

}

);

-- cut here --

This will asynchronously invoke foo.jsp with the value from datePicker. In date.jsp, you can access the value as:

<%= request.getParameter("dataPicker")%>

and use JPA to store the value in database. A simple JPA example is documented at: http://blogs.sun.com/arungupta/entry/hello_jpa_world

HTH,

Arun

Arun.Guptaa at 2007-7-29 17:20:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...