jsp页面的到html页面的转化

首先顶部要引用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>

基本的修改内容就在这些里面,小的细节要多注意。


转载于:https://my.oschina.net/u/2411767/blog/483416

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值