小编osa*_*gie的帖子

如何在thymeleaf中包含message.properties

我正在使用带百里香的弹簧靴.这是我的项目结构: 在此输入图像描述

这是我的App开始课程:

    @EnableAutoConfiguration
@Configuration
@ComponentScan
public class App {
    public static void main(String[] args) {
        SpringApplication.run(App.class);
    }
}
Run Code Online (Sandbox Code Playgroud)

我在home.leaf.html上有这个: <p th:text = "#{username}"></p>

但是当我运行这个应用程序时,这就是我得到的:?? username_en_US ??

我已经尝试了各种方法来解决此配置问题.拜托,有人可以帮忙吗?

java spring thymeleaf spring-boot

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

形式多重行动?

我有这个thymleaf页面:

<form method="post" action="#" th:object="${userData}"  >
    <table>
        <tr>
            <td><label th:text="#{manageusers.firstnamelabel}">Surname</label></td>
            <td><input required="required" type="text" th:field="*{Firstname}" /></td>
        </tr>
        <tr>
            <td><label th:text="#{manageusers.lastnamelabel}">Lastname</label></td>
            <td><input required="required" type="text" th:field="*{Lastname}" /></td>
        </tr>

    </table>

    <input type="submit" name="back" value="Back"/>
    <input type="submit" name="confirm" value="Confirm"/>
</form>
Run Code Online (Sandbox Code Playgroud)

我想要的是基于点击提交按钮的不同动作(即不同的页面控制器动作).有没有办法在百里香或春季靴子(我的控制器类)中处理这个问题?

html java spring thymeleaf spring-boot

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

asp.net core - 如何将变量从控制器传递到过滤器

我有一个控制器。在控制器的 post 方法上,有一个变量(对象变量)我想传递给我的操作过滤器:方法:

public void OnActionExecuted(ActionExecutedContext context)...
Run Code Online (Sandbox Code Playgroud)

关于如何实现这一目标有什么建议吗?

c# .net-core asp.net-core-webapi asp.net-core-2.0

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