我找不到像处理常规文本那样将占位符内的文本国际化的方法。我想将我的国际化放在:
input type="text" class="form-control" name="s" placeHolder="Search Hobbies"
与输入类型=“文本”类=“形式控制”名称=“S”占位符=“ctrlpanel.search.placeholder”
ctrlpanel.search.placeholder=搜索爱好
现在,在我的 JSP 中,我包含了标签
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<c:set var="contextRoot" value="${pageContext.request.contextPath}" />
<c:url var="search" value="/search" />
<hr/>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<form action="${search}" method="post">
<input type="hidden" name="${_csrf.parameterName}"
value="${_csrf.token}" />
<div class="input-group input-group-lg">
<input type="text" class="form-control" name="s" placeHolder="Search Hobbies">
<span class="input-group-btn">
<button id="search-button" class="btn btn-primary" type="submit">
<spring:message code="ctrlpanel.find.button" text="default text" />
</button>
</span>
</div>
</form>
</div> …Run Code Online (Sandbox Code Playgroud)创建项目后,是否可以修改Jhispster设置?例如,假设我们要更改...
Which *development* database would you like to use? H2 with in-memory persistence
Run Code Online (Sandbox Code Playgroud)
从内存中回到基于磁盘的持久性。
谢谢
我想使用 Spring PagingAndSortingRepository DAO 找到 Thymeleaf 分页的完整解决方案。我得到了一个部分解决方案,但我无法得到最后一个。我认为作为代码片段对其他人来说会很有趣,所以我会要求整个事情。我在网上找不到对我来说有点奇怪的解决方案(因为我认为这可能是一个非常普遍的问题)。
最终的解决方案应该表现得像谷歌的分页:只有在有意义的情况下才在两边都有箭头;最多 10 个数字(例如),当您单击向右箭头时,它应该从 1..10 --> 11..20 等移动;当你点击 10 时移动到 5..15。就像谷歌一样,你知道。大小控制每个页面中的项目数,而不是分页栏中的块或链接数。
我在 Spring 中有一个 DAO 存储库,它扩展了 PagingAndSortingRepository ...
包 music.bolo.domain.repository;
导入 org.springframework.data.repository.PagingAndSortingRepository; 导入 org.springframework.stereotype.Repository;
导入 music.bolo.domain.entity.Announcement;
@Repository 公共接口 NoticeDao 扩展 PagingAndSortingRepository {
公告 findFirstByOrderByDateDesc(); }
所以我的服务可以发出请求,每个页面都会得到 totalPageNumbers(http://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/domain/Page.html)。 ..
私有最终静态 int PAGESIZE = 2;
.. .. @Autowired 注释...
Run Code Online (Sandbox Code Playgroud)public Page<Announcement> readAnnouncementPage (int pageNumber){ PageRequest request = new PageRequest(pageNumber-1, PAGESIZE, Sort.Direction.DESC, "date"); return announcementDao.findAll(request); }
我的控制器使用数据将所有信息发送到 Thymeleaf
Run Code Online (Sandbox Code Playgroud)@RequestMapping(value = "/viewannouncements", method = RequestMethod.GET) …
我在博客应用程序中使用 Matt Raible 示例http://gist.asciidoctor.org/?github-mraible/jhipster4-demo//README.adoc当我尝试删除博客而不先删除该博客的所有条目时,它给我一个内部服务器错误(DataIntegrityViolationException)。
org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint ["FK_ENTRY_BLOG_ID: PUBLIC.ENTRY FOREIGN KEY(BLOG_ID) REFERENCES PUBLIC.BLOG(ID) (2801)"; SQL statement:
delete from blog where id=? [23503-197]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:278)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:244)
Run Code Online (Sandbox Code Playgroud)
我想知道在使用 JDLStudio.jh 定义文件的 JDL-Import 时是否有任何方法可以获得删除级联,如果不可能,是否有人知道如何最好地完成它。一如既往,任何例子都会很棒!