2018-04-21
1.问题:前端到底能不能将BigDecimal传个我啊?
答:虽然说前端没有这样的数据类型,但是后台能接受到成BigDecimal
2.问题:themleaf对于如果是1则显示A 如果是2显示B 如果是3显示C 如果是4显示D
虽然有th:text="${a==a?'a':'不是a'}”我这个岂不是写的又臭又长
答:是的
内容如下,真实可测
<td th:text="${worksheetOne.worksheetPrior==1?'A':( worksheetOne.worksheetPrior==2?'B':(worksheetOne.worksheetPrior==3?'C':(worksheetOne.worksheetPrior==4?'D':worksheetOne.worksheetPrior))) }">A</td>
3.themleaf字符串截取,前10位
th:text="${#strings.abbreviate(worksheetOne.content,10)}"
str截取0-10位,后面的全部用…这个点代替,注意,最小是3位
4.对象传参方法如下
function findEmpByUserId() {
var userId = parseInt($(".p_user").text());
console.log("hehe"+userId);
util.ajax('/setting/empList/findEmpByName?userId='+userId, {}, function (result) {
if (result.success) {
console.log(result)
console.log(result.spUserDto.fullName);
$(".p_user").text(result.spUserDto.fullName);
}
});
}
而不是
function findEmpByUserId() {
var userId = parseInt($(".p_user").text());
console.log("hehe"+userId);
util.ajax('/setting/empList/findEmpByName', {userId: userId}, function (result) {
if (result.success) {
$('#p_user').append("<p>" + result + "</p>")
}
});
}
5.themleaf 后台需要传入page对象
<ul class="pagination" th:if="${!#lists.isEmpty(contractResourceDtoList)}">
<li><a href="#" th:href="@{'/resource/resourceInfo?resourceId='+${resourceDto.resourceId}+'&pageNo1='+${page1.previous}}">«</a></li>
<li th:each="i : ${#numbers.sequence(page1.pageFrom, page1.pageTo, 1)}" th:class="${i} == ${page1.page} ? 'active' : ''">
<a href="#" th:href="@{'/resource/resourceInfo?resourceId='+${resourceDto.resourceId}+'&pageNo1='+${i}}" th:text="${i}">1</a>
</li>
<li><a href="#" th:href="@{'/resource/resourceInfo?resourceId='+${resourceDto.resourceId}+'&pageNo1='+${page1.next}}">»</a></li>
</ul>
5.themleaf 或者表达式写法
<div th:if="${list.pdType} == 5 or ${list.pdType}==6">... do something ...</div>