Tag: 百里香

从Thymeleaf进入课堂

如何从Thymeleaf访问一些简单的POJO静态属性? 例如: public final static int PROJECT_NAME_MAX_LENGTH = 255; 如何输入:

Spring Boot + Thymeleaf +蒲公英配置不起作用

我正在使用Thymeleaf的Spring Boot,现在我想添加蒲公英数据表,但它不起作用。 这是我的maven依赖项: org.springframework.boot spring-boot-starter-parent 1.2.1.RELEASE org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-thymeleaf org.springframework.boot spring-boot-starter-websocket org.springframework.boot spring-boot-starter-tomcat provided org.springframework.boot spring-boot-starter-test test com.github.dandelion datatables-thymeleaf 0.10.1 我正在遵循本指南http://dandelion.github.io/dandelion/docs/installation/thymeleaf.html并配置以下bean: @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Bean public FilterRegistrationBean dandelion() { FilterRegistrationBean registrationBean = new FilterRegistrationBean(); registrationBean.setFilter(new DandelionFilter()); registrationBean.addUrlPatterns(“/*”); return registrationBean; } @Bean […]

Thymeleaf复选框没有传递值

两个问题。 我有User和Note课程。 用户可以有很多笔记。 如何通过Thymeleaf展示属于用户的每个笔记? th:text =“$ {u.notes.id}”不起作用 我有一个表(见图),每个用户的复选框都有boolean isUserChecked值,下面是删除已检查用户的按钮。 Thymeleaf正确显示isUserChecked值的状态。 当我手动选中复选框时,删除按钮不起作用,但是当我在代码中设置isUserChecked值时,该按钮有效。 问题在于我的Thymeleaf语法中的这个复选框。 截图: HTML Id Username First name Last name Password (Hash) Role Notes Select Submit 更新1 正如@Metroids提到的第一个问题可以修复: 0 ? ‘, ‘ : ”) + note.id}” /> 第二个问题。 在我的html中使用它: 我需要具有属性List listOUsers UserWrapper类。 但是怎么做呢? 我创建了这样的东西: @Component public class UserWrapper { @Autowired UserService userService; List listOfUsers = […]

输入类型=“日期”百里香

我需要向我的实体添加日期,并让用户以webforms设置它。 默认情况下,此字段需要填写今天的日期。 1. 显示为默认设置的正确日期 2. 显示没有任何值的日期选择器(注意:String startDate =“2016-08-01”;) 3. 生成400错误(错误请求)(注意:日期startDate = new Date();) 所以,问题是:如何使用百日咳作为输入日期? 我可以使用Date()数据类型输入和存储这些数据吗? 我怎么需要在表格中设置“th:field”? 我怎么需要以相同的forms设置“th:value”? 我的控制器: @RequestMapping(“/project_new”) public String createProject(Model model) { Project project = new Project (); List roles = mRoleService.findAll(); project.setStart(new Date()); model.addAttribute(“page_title”, “create project”); model.addAttribute(“roles”, roles); model.addAttribute(“statuses”, Status.values()); model.addAttribute(“project”, project); return “project_new”; } @RequestMapping(value = “/project_new”, method = RequestMethod.POST) public […]

列出Thymeleaf中所有可用的模型属性

出于调试目的,我想列出我的百万美元模板在渲染时可用的所有模型属性。 就像是: 但显然这是胡说八道,我得到了一个当之无愧的错误。 ( org.springframework.expression.spel.SpelParseException: EL1070E:(pos 0): Problem parsing left operand ) 有没有办法输出这样的调试信息? 即使是一些日志输出,我也会满意。 或者,Thymeleaf是否提供类似于Struts 2的struts.devMode ,它在页面底部添加了一个列出所有可用属性的调试部分?