@PropertySource(value = {
"classpath:i18n/messages.properties"
}, encoding = "UTF-8")
@Configuration
public class I18nAutoConfiguration {
@Bean
public ReloadableResourceBundleMessageSource messageSource() {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setDefaultEncoding("UTF-8");
messageSource.setCacheSeconds(3600);
messageSource.setBasenames(
"classpath:i18n/messages");
return messageSource;
}
@Bean
public LocaleResolver localeResolver() {
AcceptHeaderLocaleResolver localeResolver = new AcceptHeaderLocaleResolver();
localeResolver.setDefaultLocale((Locale.forLanguageTag("en")));
return localeResolver;
}
}
List<DTO>
th:if="${el.Trackable_ID == el.PERSON_ID}"
@Controller
@RestController
. Или же к этому методу добавить @ResponseBody
@Controller
и @RestController
Required request parameter 'x0' for method parameter type double is not present
@RequestParam int x0,
поменять на @RequestParam double x0,
, либо посмотрите почему фронт не отправляет целочисленный тип. Например, можно поэкспериментировать с атрибутом step тега input JpaSpecificationExecutor<Book>
<option selected>Как сюда поместить значение переменной Thymeleaf??</option>
<option th:each="ru: ${rule}"
th:value="${ru.id}"
th:text="${ru.name}">
</option>
th:selected
th:each
вы при помощи th:selected
проверяете на совпадение и если значение переменной и элемента из цикла совпадают, то добавляете атрибут. Thymeleaf, как добавить значение по умолчанию для параметра, если он отсутствует при нажатии на ссылку?
.on('click', function(){})
или .click()
th:inline
<h4 th:inline="text">[[${product.name}]]<span th:text="${product.getPrice()}">45</span></h4>
List<Category> category = categoryService.getAll();
th:field="*{category}"
category :
на что-нибудь другое. Например, cat
и соответственно, смените его в соответствующих строках тоже.<option th:each="category : ${categoryList}" value="${category.id}"
th:text="${product.category}"></option>
th:text="${product.category}"
product.category
, а так как product новый: Product product = new Product();
, то и присвоенной категории для него тоже не будет. todo.setCompleted("No");
Я так понимаю так же нужно настраивать Thymeleaf?
<img th:src="${image}" alt="Картинка"/>
th:fragment
, а затем вставили этот фрагмент при помощи th:insert
. А в чем заключается проблема? Что-то не работает или ...?th:insert="header :: header"
это может не работать или просто выдавать предупреждение. Используйте th:insert="~{header :: header}"
<tr form th:action="@{/}"
th:object="${addUser}" method="POST">
<td><input/></td>
<td><input type="text" th:field="*{lastName}" /></td>
<td><input type="text" th:field="*{firstName}" /></td>
<td><input type="text" th:field="*{email}" /></td>
<td><input type="text" th:field="*{number}" /></td>
<input type="submit" value="add" />
</form>
<tr form th:action="@{/}"