Dancyg Dancyg - 9 months ago 24
Javascript Question

Fetch doT template from the server with JAVA Spring

I started to work with JAVA Spring recently as operator for server-side. I have doT.js template laying on the server, so when clicking on navigation bar button - I need to fetch somehow this template and after rendering it with javascript - append it to page container.
Should I have special JAVA controller for this purpose or AJAX request can somehow fetch it from server without special controller?


Problem was solved without special JAVA controller - directory "resources" can be accessed with AJAX directly (with specifying full path). I fetched doT template as simple html file.

        .then(function(body) {


        var elementTemplate = doT.template($('#elementAnother').text());