How to separate number with commas in Thymeleaf [duplicate] - spring-boot

This question already has answers here:
How to format the currency in HTML5 with thymeleaf
(4 answers)
Closed 3 years ago.
How to display Number with comma every 3 numbers in Thymeleaf?
For example, 12345678 I want to display this number as 12,345,678 . I got my data from Spring Boot
<div class="value" th:text="${price}"></div>

You can try this way:
<div class="value" th:text="${#numbers.formatDecimal(price, 0, 'COMMA', 0, 'POINT')}"></div>

Related

How to Extract all the values form the regular expression extractor and pass the all value to parameter of the http request [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Here is the sample view
Home Home
I have tried
$1$$21$$41$$61$$81$$101$$121$$141$$161$$181$$201$$221$$241$$261$$281$$301$
but its not get correct value
One of the solutions could be:
Create a user-defined variable, suppose "my_variable"
Create a "Regular Expression" which will list all the values from the response, Test it using expression tester
Now under the sample from where you want to extract the information, create a JSR223 Post Processor and use the sample code as per below:
We cannot help you without seeing:
Full (or at least partial) response containing the "values" you want to extract
How you're going to re-use them in the next request
One thing is obvious: using regular expressions for extracting values from HTML is not the best idea, I would recommend going for CSS Selector Extractor instead, given your response data:
<a class="main mainAnchor current currentAnchor" tabindex="-1" href="Form1"> <span>Home</span> <a
class="main mainAnchor parent parentAnchor" tabindex="-1" href="Form2"><a
class="main mainAnchor current currentAnchor" tabindex="-1" href="Form3"> <span>Home</span> <a
class="main mainAnchor parent parentAnchor" tabindex="-1" href="Form4">
You can extract all href attributes of the <a> element as simple as:
More information: CSS Selector Reference

I am trying to update with multiple id's in laravel [duplicate]

This question already has answers here:
Use an array in Laravel update query
(3 answers)
Closed 1 year ago.
Customer::where('id'=>[5,6,7])->update(['name' => "Ashutosh"]);
Try like this:
Customer::whereIn('id', [5,6,7])->update(['name' => "Ashutosh"]);
You can found in docs about whereIn.

Ruby | 2 float number multiple not giving the exact value [duplicate]

This question already has answers here:
Is floating point math broken?
(31 answers)
Closed 5 years ago.
I have 2 float number and I try to get the multiple. But in the console it does not get the correct one. I do not know maybe there is a leak ?
{"price"=>"0.049391", "size"=>"0.001"}
When I multiple them console shows;
************
0.049391
************
0.001
************
4.9390999999999995e-05
************
Then when I push this data to array and in front end when I console.log
I get;
0.000049390999999999995
Why it is not 0.0000493901 ?
4.9390999999999995e-05 and 0.000049390999999999995 are the same number. e-05 is nothing more than notation for "move the decimal place five spots to the left".

<c:if test=""> doesn't work [duplicate]

This question already has answers here:
jstl <c:if> tags not working in jsp file, getting error in tomcat 7
(2 answers)
Closed 5 years ago.
I'm new to JSTL and for some reason, I can't get the test line to work. Here is the simplified code I'm using:
<c:if test="${hasChild}">
test
</c:if>
when I use
${hasChild}
it prints true to the screen but it doesn't woork on the test line and I don't know why. Can anyone help please?
Have you declared hasChild prior to the test taking place? i.e.
<c:set var="hasChild">*Something which makes this value true*</c:set>
<c:if test="${hasChild}">
test
</c:if>

Render the results of an Action to a string [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Render a view as a string
How can I render the results of a Controller Action to a string in MVC 3 (So I can send them as an email)?
The most simple solution is probably this:
string body = Html.Action("Mail").ToHtmlString();

Resources