
[英]Spring doesnt display images when there is a path variable on URI
我的 controller 中有一个方法可以指向带有评论的页面。 所有评论都与特定消息相关。 我使用 pathvariable 发送 messageID,我稍后使用它从我的数据库中获取评论。 然后我有一个从数据库中获取图像的方法 listComments.html 将我用于 go 的链接添加到 l ...
[英]Spring doesnt display images when there is a path variable on URI
我的 controller 中有一个方法可以指向带有评论的页面。 所有评论都与特定消息相关。 我使用 pathvariable 发送 messageID,我稍后使用它从我的数据库中获取评论。 然后我有一个从数据库中获取图像的方法 listComments.html 将我用于 go 的链接添加到 l ...
[英]Spring Boot + Thymeleaf embed Tailwind CSS inside HTML for external service?
我有一个 spring 引导项目,我正在使用 TailwindCSS。 问题是,同时把<link rel="stylesheet" type="text/css" th:href="@{~/css/main.css}" /> 当我想从我的实例本地访问 HTML 文件时工作正常,问题是 ...
[英]Thymeleaf View Resolver with SpringMVC webapp
如果可以使用ThymeleafViewResolver作为默认视图解析器会怎么样。 目前我的WebMvcConfig看起来像这样 对于*.jsp视图,它工作正常,但我想使用 Thymeleaf 来解析我的.html模板,因为我不想使用*.jsp 。 需要注意的一件事是,在我的 controller ...
[英]How can you use Spring DeleteMapping with HTML-form or etc?
我想在 Spring-Controller-Class 中使用 DeleteMapping: 我想读入 html 中的一个 id 并删除该员工。 如何使用 HTML 执行此方法? ...
[英]Cannot load the image from database to thymleaf
这是我的 editprofile.html: 我在从数据库中添加和检索数据时进行了压缩和解压缩代码:ImageUtil.java 我上传图片如下: 并且图片成功保存到db 问题是图像无法显示。我在从数据库中检索数据时这样做了: pojoprofile.setEncoded_image(base6 ...
[英]Formatting phone number in the thymeleaf html page
我有一个不同格式的电话号码列表,例如“1234567-8901”、“49123456 6544”、“861234567899”以及许多其他格式。 我想将电话号码格式化为例如美国电话号码的格式,它应该显示为“+ 1 xxx-xxx-xxxx”。 我们正在使用 thymeleaf 和 js 来实现这个。 ...
[英]How to change background color html attribute using thymelaf?
我正在尝试在 web 应用程序中使用 model 中的特定值更改背景颜色。 其中 task.color 是从 model 中选择的默认 html 颜色的字符串值,但这种方式不起作用。 如何使用给定 DIV 上 model 的颜色集更改背景颜色? 谢谢 ...
[英]Thymeleaf results in error when using variable inside an expression
对于我的 model 中提供的字符串,我想打印一个“不断增长”的子字符串列表。 例如,如果给定的字符串是Wine ,结果应该是: 我想出了以下结构: 但它不起作用。 如果我将${#numbers.sequence(1, ${len})}更改为${#numbers.sequence(1, 4)}它会起 ...
[英]Springboot server-side chart creation
我想在服务器端创建谷歌图表。 我找到了一些插件,例如 - GWT Tutorial ,但我没有发现它有帮助,因为我们需要客户端交互。 我需要一些可以在服务器端创建图表的东西,这样我就可以存储这些图表图像而无需用户交互。 我还找到了另一个插件 - Charts4j ,但我没有找到该插件的任何有用示例或 ...
[英]Not Showing error in field of model object in thymeleaf page
Thymeleaf 方法fields.errors()用于收集所有验证,未在 html 页面中显示错误,并给出错误我已经尝试了所有方法来捕获错误。 也试过, https://www.thymeleaf.org/doc/tutorials/2.1/thymeleafspring.html#dynam ...
[英]How can I get the information that I already put in H2 Database to thymeleaf page?
客户端.java ClientController.java ClientRepository.java 主要.java 家.html 这是我的包裹的 ss 这是 localhost:8080 中的错误 ss 这是h2数据库我尝试更改 home.html 文件但没有任何反应我认为问题出在 ho ...
[英]how can a user change their password in this website?
我正在使用 Spring Boot 创建一个网站。 我有一个模板 (thymeleaf),用户可以在其中更改密码。 但是当用户写一个新密码时,密码不会改变。 它重定向到我的主页,但没有任何反应。 没有错误。 我更改密码的后端: @Controller @Service @Repository 安全 ...
[英]Getting a NumberFormatException with thymeleaf on th:field but not on others th:*
我对 Thymeleaf 很陌生,所以这可能是一个新手错误。 而且我一直在网上到处寻找答案,但没有找到。 很抱歉,如果这真的很基本。 基本上我将 Thymeleaf 与 SpringBoot 2.6.7 一起使用,我想使用表单填充对象。 我过去能够做到的事情,但这次我想要填充的对象第一次包含其他对 ...
[英]Can Thymeleaf convert a String object to a ('2023-07-01') to date.formate so it looks like 01 Jan 2023?
我觉得这已经得到了回答(抱歉),但我似乎无法弄清楚我做错了什么。 所以我有一个 spring crud 应用程序,我的日期是一个字符串,而不是日期对象,并且在我的表中显示为 2023-07-01,一切都很好。 现在有没有一种简单的方法可以简单地将这个字符串变成一个日期对象,这样我就可以做${#da ...
[英]Write value from Select in DTO Thymeleaf
我有一个实体“用户”。 我有一个枚举“Usertyp”。 用户有一个字段“usertyp”。 我想通过将 DTO 传递给我的控制器来更改“Usertyp”。 问题是用户类型在数据库中更改为 Null 另一个小问题是我希望选择字段的默认值将用户当前的用户类型作为默认值。 我试过“ 还有一个 if 语句 ...
[英]Externalize favicon with Spring Boot and Thymeleaf
使用 Spring Boot 和 Thymeleaf 外部化网站图标出于不重要的原因,我试图从不在 classpath 上的目录中获取我的 Spring Boot 项目中的图标。 我能够加载该目录的图像或其他资产,但由于某种原因无法加载图标。 这是我创建的一个演示项目,用于说明问题和到目前为止我尝试 ...
[英]how to set selected value in drop down menu depending on conditions
我有下拉菜单的代码。 此菜单的对象有几个字段。 其中两个是 playerPosition 和 isFirstSquadPlayer。 如果 isFirstSquadPlayer 为 TRUE,我需要在菜单 player.playerPosition 中显示。 尝试了几种方法但失败了。 我的控制器: ...
[英]Use javascript function in th:if for filtering some table entities
我想隐藏不满足用 javascript 函数编写的日期条件的表行。 th:onclick 属性工作正常并返回正确的比较。 但是当我在 th:if 中运行相同的函数时,如果函数没有被调用! 函数调用的语法: 情况 1:函数被调用并返回 true 或 false 我想用于表行过滤的情况 2:未调用该函 ...
[英]Using spring controller to provide list to html and make a drop down menu
我创建了一个 controller 以将 pojo 对象列表传递给 html。当我引用 IDE 找到的列表时,这似乎是有效的。 但是,当我引用列表元素中的字段时,它找不到它,并且它没有返回值,而是返回文字文本。 html 内搜索游戏 html 游戏 class 是一个简单的 pojo,具有名字、姓 ...
[英]Calling method A is forbidden for type B in Thymeleaf expressions
我刚把web项目升级到Spring 6、Spring Boot 3 GA,现在处理如下Thymeleaf不兼容。 我正在生成表格 select。 th:selected中的表达式失败,出现以下异常。 bankAccount.getId()和$bankAccountId都是java.util.U ...