Thymeleaf th:text

Bir stringi ekrana yazdirmak icin kullanilir.
Variable degiskenimizin

	model.addAttribute("variable", "dogukan");
	model.addAttribute("variable2", "han");
	model.addAttribute("variableInt",3);
	model.addAttribute("variableInt2",4);
	model.addAttribute("variableHtml", "<h1>Dogukan </h1>");

 

<p th:text="${variable}"> Test Variable </p>

=dogukan

<p th:text="Selam + ${variable}"> Test Variable </p>

=Selamdogukan

<p th:text="'Selam '+ ${variable}"> Test Variable </p>

=Selam dogukan

<p th:text="'Selam '+ ${variable} + ${variable2}"> Test Variable </p>
<p th:text="'Selam '+ ${variable+variable2}"> Test Variable </p>

=Selam dogukanhan

<p th:text="'Selam '+ ${variable+' '+variable2}"> Test Variable </p>

=Selam dogukan han

<p th:text="'Selam '+ ${variable+' '+variable2}+' '+${variableInt}"> Test Variable </p>

=Selam dogukan han 3

<p th:text="${variableInt}+${variableInt2}"> Test Variable </p>
<p th:text="${variableInt+variableInt2}"> Test Variable </p>

=7

<p th:text="${variableInt+''+variableInt2}"> Test Variable </p>
<p th:text="${variableInt}+''+${variableInt2}"> Test Variable </p>

=34

<p th:text="${variable.split('k')[1]}"> Test Variable </p>

=an

<p th:text="${variable.substring(0,3)}"> Test Variable </p>

=dog

<p th:text="${variableHtml}"> Test Variable </p>

=&lt;h1&gt;Dogukan &lt;/h1&gt;

<p th:utext="${variableHtml}"> Test Variable </p>

=<h1>Dogukan </h1>

<p th:text="${variableInt == 3}"> Test Variable </p>

=true

<p th:text="${variable}"> Test Variable </p>

=<p>dogukan</p>

<div th:text="${variable}"> Test Variable </div>

=<div>dogukan</div>

 

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *