i have a problem to load the event data from mysql to jquery fullcalendar..the example given is in php and i dont know how to do it java.. this is the sample code:
111, 'title' => "Event1", 'start' => "$year-$month-10", 'url' => "http://yahoo.com/" ) )); ?>
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Carriage Return (ASCII chr 13) is missing from tex
You need to create a
Servlet
for that. Create a class whichextends HttpServlet
and write code indoGet()
accordingly that it writes the desired JSON string to the response. You can use Google Gson to convert Java objects to a JSON string.For example:
Then just map this servlet in
web.xml
on the desiredurl-pattern
.Instead of a
Map
you could even create your Javabean classEvent
:You could even use Gson to convert it:
This way you can more easy collect them all in a
List<Event>
which is preferable above aList<Map<String, String>>
:First you need to invoke the servlet from jQuery - you do this with $.ajax(). Then you need to pass the result to the calendar. The following works fine:
Greetings, Sorin
In your servlet put this script: