首先顶部要引用thmeleaf标签
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
对于c:if语句的转化
<c:if test="${sessionScope.UVO.guestName==null}">
<meta http-equiv="REFRESH" content="0;url=initGuestLogin" />
</c:if>
转为
<div th:if="${#strings.isEmpty(session.UVO.guestName)}">
<meta http-equiv="REFRESH" content="0;url=initGuestLogin" />
</div>
对于form里内容的转化:
form:form modelAttribute="alipayForm" action="alipaySubmit"
method="post">
<form:hidden path="outTradeNo" value="${alipayForm.outTradeNo}"/>
<form:hidden path="subject" value="${alipayForm.subject}"/>
<form:hidden path="body" value="${alipayForm.body}"/>
<form:hidden path="price" value="${alipayForm.price}"/>
<form:hidden path="showUrl" value="${alipayForm.showUrl}"/>
<form:hidden path="receiveName" value="${alipayForm.receiveName}"/>
<form:hidden path="receiveAddress" value="${alipayForm.receiveAddress}"/>
<form:hidden path="receiveZip" value="${alipayForm.receiveZip}"/>
<form:hidden path="receivePhone" value="${alipayForm.receivePhone}"/>
<form:hidden path="receiveMobile" value="${alipayForm.receiveMobile}"/>
转化为
<form name="alipayForm" th:object="${alipayForm}" action="alipaySubmit"
method="post">
<input type="hidden" name="outTradeNo" th:value="${alipayForm.outTradeNo}"/>
<input type="hidden" name="subject" th:value="${alipayForm.subject}"/>
<input type="hidden" name="body" th:value="${alipayForm.body}"/>
<input type="hidden" name="price" th:value="${alipayForm.price}"/>
<input type="hidden" name="showUrl" th:value="${alipayForm.showUrl}"/>
<input type="hidden" name="receiveName" th:value="${alipayForm.receiveName}"/>
<input type="hidden" name="receiveAddress" th:value="${alipayForm.receiveAddress}"/>
<input type="hidden" name="receiveZip" th:value="${alipayForm.receiveZip}"/>
<input type="hidden" name="receivePhone" th:value="${alipayForm.receivePhone}"/>
<input type="hidden" name="receiveMobile" th:value="${alipayForm.receiveMobile}"/>
对于此种语句的转化<h3>客户订单号:${alipayForm.outTradeNo}</h3>
<h3>客户订单号:<span th:text="${alipayForm.outTradeNo}"></span></h3>
对于报错语句${message}<form:errors path="*"></form:errors>
也就是值不能为空的语句应该这样修改
<span th:if="${#fields.hasErrors('${alipayForm.*}')}"><span th:errors="${alipayForm.*}"></span></span>
<span th:text="${message}"></span>
基本的修改内容就在这些里面,小的细节要多注意。