小编Nic*_*ski的帖子

Thymeleaf #strings.trim() 不起作用

简而言之:我正在从 google place api 获取数据,并希望基于它在我的数据库中创建实体。我在用户名字段上有 @Email 注释,因此它不能包含空格。我试图使用这样的东西:

th:value="${#strings.trim(place.name) + '@mywebsite.com'}"
Run Code Online (Sandbox Code Playgroud)

但是,这似乎不起作用...我也尝试了不同的方法,只是为了仔细检查语法是否正确,例如:

th:value="${#strings.toLowerCase(place.name) + '@mywebsite.com'}"
Run Code Online (Sandbox Code Playgroud)

它的效果很好。

提前致谢!

string trim thymeleaf

3
推荐指数
1
解决办法
6013
查看次数

如何在一个表单中为 Thymeleaf 中的多个对象填写字段?

我有以下模型(没有 getter 和 setter 以提高可读性):

   @Entity
public class Recipe extends BaseEntity {
  private String name;
  private String description;
  private Category category;

  @OneToMany(mappedBy = "recipe", cascade = CascadeType.ALL)
  private List<Ingredient> ingredients;

  @OneToMany(mappedBy = "recipe", cascade = CascadeType.ALL)
  private List<Instruction> instructions;

  @ManyToMany
  private List<User> administrators;

  private int preparationTime;
  private int cookTime;

  public Recipe(){
    super();
    ingredients = new ArrayList<>();
    instructions = new ArrayList<>();
    administrators = new ArrayList<>();
  }

  public Recipe(String name, String description, Category category, int preparationTime, int cookTime) {
    this();
    this.name = …
Run Code Online (Sandbox Code Playgroud)

post controller view thymeleaf spring-boot

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

thymeleaf ×2

controller ×1

post ×1

spring-boot ×1

string ×1

trim ×1

view ×1