OiO.lk Blog java Pebble Template – Html tags are getting visible in page
java

Pebble Template – Html tags are getting visible in page


I want the list that is ownerList to be displayed one after other, for that i am using for loop in pebble engine template. But i am getting output with html tags appended.

How to display list one after other using pebble template

current output

<p>Greece </p>

<p>Anthony</p>

displaying with <p> and </p> tags

Expected Output

Greece

Anthony

I want output to print without html tags.

I have created the template

OwnerList.peb

{% for owner in ownersList%}
<p>{{ owner.dateTime }}</p>
{% endfor %}

Code

        PebbleEngine engine = new PebbleEngine.Builder().build();
        PebbleTemplate compiledTemplate = 
        engine.getTemplate("OwnerList.peb");

        Map<String, Object> context = new HashMap<>();
        context.put("ownerList", ownerList);

        Writer writer = new StringWriter();
        compiledTemplate.evaluate(writer, context);

        String output = writer.toString();`



You need to sign in to view this answers

Exit mobile version