📅  最后修改于: 2022-03-11 14:53:21.875000             🧑  作者: Mango
The best way to allow optional parameter for a fragment is to declare them with "th:with" and describe them with meaningful default values.
So, you define explicit your mandatory and your optional values in the declaration tag of your fragment.
Here is simple example, with 1 mandatory and 2 optional parameters:
Hello
Mr.
John Doe
You can then call it like the following:
Hello Mr. Daniel
Hi Ms. Lea
(Please note that all values inside the tags are replaced by the dynamic ones. It's just for better reading.)