HTML页与JSP页

    在HTML中循环遍历数据库中数据时不用<c: forEach>而是用< th:--->,<c: forEach>会破坏HTML页,并在配置文件配置视图解析器themeleaf,导入几个重要的包:

  lombok-1.16.2.jar   thymeleaf-2.1.4.RELEASE.jar     thymeleaf-spring4-2.1.4.RELEASE.jar   unbescape-1.1.0.RELEASE.jar

<tr th:each="user,status:${list}">表示循环。

   <a th:href="@{deleteid(userID=${user.userID})}">表示链接(格式!)

   <span th:text="${user.userID}">12</span>用来承接传过来的值

   <form action="all" th:object="${UserBean}" method="post">传值时要用此格式声明

   <input name="password" type="text" th:value="${UserBean.password}"/>用文本框承接传过来的值

 

<!-- thymeleaf的视图解析器 -->
   <bean id="templateResolver"
	class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
	<property name="prefix" value="/WEB-INF/html/" />
	<property name="suffix" value=".html" />
	<property name="templateMode" value="HTML5" />
	<property name="order" value="1"/>	
    </bean>
    <bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
	<property name="templateResolver" ref="templateResolver" />
    </bean>	
    <bean id="viewResolverThymeleaf" class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
        <property name="templateEngine" ref="templateEngine" />
        <property name="characterEncoding" value="UTF-8"/>
        <property name="order" value="0"/>
   </bean>

 

转载于:https://my.oschina.net/u/2411785/blog/479530

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值