Dropwizard Mustache

32 views
Skip to first unread message

Sachin Nemade

unread,
Jun 26, 2020, 4:45:59 AM6/26/20
to dropwizard-user
Dropwizard Mustache's Render not woking.

{{person.name}}{{lastname}} from java POJO working. but "hello {{name}}" not working.

Can we handle events, such as change in select using Dropwizard Mustache.

<html>
<head>

</head>
    <body>
        <!-- calls getPerson().getName() and sanitizes it -->
        <h1>Hello, {{person.name}} {{lastname}}</h1>
        <div id="myTemplate">hello {{name}}</div>
    </body>
    
    <script type="text/javascript">
$(document).ready(function() {

var myTemplate = $("#myTemplate").html();
console.log(myTemplate);
var obj = {
    name: "sachin"
};

var filledTemlate = Mustache.render(myTemplate, obj);
console.log(filledTemlate);
$("#myTemplate").html(filledTemlate);


    });
    </script>
</html>

Jochen Schalanda

unread,
Jun 26, 2020, 6:58:43 AM6/26/20
to dropwiz...@googlegroups.com
Hi Sachin,

the Dropwizard Mustache View integration is a server-side rendering technology but it looks like you're trying to render the template on the client-side using a Javascript library.

See https://www.dropwizard.io/en/latest/manual/views.html for how to use the Dropwizard integration (server-side).

Cheers,
Jochen

> Sachin Nemade <sacheen...@gmail.com> hat am 26.06.2020 10:45 geschrieben:
> --
> You received this message because you are subscribed to the Google Groups "dropwizard-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to dropwizard-us...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dropwizard-user/00511727-e9de-475a-965a-ad902d1f0163o%40googlegroups.com (https://groups.google.com/d/msgid/dropwizard-user/00511727-e9de-475a-965a-ad902d1f0163o%40googlegroups.com?utm_medium=email&utm_source=footer).
>

Sachin Nemade

unread,
Jun 26, 2020, 7:13:59 AM6/26/20
to dropwiz...@googlegroups.com
Hi Jochen,

Thank you for the information.

My goal was to have few interdependent Combos on a page displayed from Dropwizard Mustache. Does it mean Server side rendering will not allow me to add client side event handling?

Code works nicely if used without dropwizard integration.




--
Regards,
Sachin N,
(9833204992)
Reply all
Reply to author
Forward
0 new messages