我必须从html页面(带有少量输入文本字段的简单表单)向页面控制器发送数据,然后发送到数据库.我正在使用thymeleaf 2.0.17,spring 3.0.我搜索并检查了一些解决方案,但没有奏效.也许有人有同样的问题,并找到一些好的解决方案.请帮忙.谢谢
我将尝试测试我的端点中的一个方法(spring 3.1,junit 4.11)以下是我的代码:applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns: p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schem...ng-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schem...ontext-3.0.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schem...ring-cache.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:component-scan base-package="app.controller, app.samples" />
<context:annotation-config/>
<annotation-driven />
</beans>
Run Code Online (Sandbox Code Playgroud)
和测试类:
package app.tests;
import app.samples.TableEndpoint;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autow ired;
import org.springframework.test.context.ContextConfigurat ion;
import org.springframework.test.context.junit4.SpringJUni t4ClassRunner;
@ContextConfiguration(locations = {"classpath:/WEB-INF/applicationContext.xml"})
@RunWith(SpringJUnit4ClassRunner.class)
public class TableTest {
public TableTest() {
}
@Autowired
TableEndpoint tableEndpoint;
@Test
public void testTableEndpoint(){
String result = tableEndpoint.getDane().get(0); …Run Code Online (Sandbox Code Playgroud) 我有来自数据库的数据表(动态插入).在一列中,我插入复选框.现在我想选择其中一个并发送到下一个表单(我选择一个产品并将属性发送到另一个表单.在这个表单中应该只显示属性选择产品).但我不知道插入了什么样的值:field ="*{}".我尝试了很多解决方案但是没有用.我的html表单包含所有产品表:
<form action="/oferta/zamow" th:action="@{/oferta/zamow}"
th:object="${oferta}" method="post">
<table border="1" id="display-data">
<tr>
<td>#</td>
<td>title</td>
<td>author</td>
<td>rok</td>
<td>cena</td>
<td></td>
</tr>
<tr th:each="produkt, pozycja : ${oferta}">
<td th:text="${pozycja.count}"></td>
<td><span th:text="${produkt.tytul}"></span></td>
<td><span th:text="${produkt.autor}"></span></td>
<td><span th:text="${produkt.rok}"></span></td>
<td><span th:text="${produkt.cena}"></span></td>
<td>
<input type="submit" value="zamow"/>
<!-- <a th:href="@{/zamowienie}">zamow</a> -->
</td>
<td>
<label>zamow</label>
<input type="checkbox" th:field="*{produkt}" th:value="${produkt}"/>
</td>
</tr>
</table>
</form>
Run Code Online (Sandbox Code Playgroud)
表格显示选择产品:
<form action="/zamowienie/zam" th:action="@{/zamowienie/zam}"
th:object="${zamowienie}" method="post">
<table border="1" id="display-data">
<tr align="center">
<td colspan="2">twoje zamowienie</td>
</tr>
<tr>
<td>tytul</td>
<td><span th:text="${produkt.tytul}"></span></td>
</tr>
<tr>
<td>autor</td>
<td><span th:text="${produkt.autor}"></span></td>
</tr>
<tr>
<td>rok</td>
<td><span …Run Code Online (Sandbox Code Playgroud) 我有来自数据库(mysql)的表和显示数据.我用百里香.所有字段都可以,但sb.cover不显示jpg(我的数据库中的blob列).您是否有任何想法如何使用百里香叶将jpg放入网页?谢谢
<tr th:each="sb, poz : ${product}">
<td th:text="${poz.count}">1</td>
<td th:icon="${sb.cover}"></td>
<td th:text="${sb.title}"></td>
<td th:text="${sb.price}"></td>
<td ><b><a th:href="@{/details}">DETAILS</a></b></td>
<td ><b><a th:href="@{/cart}">ADD TO CART</a></b></td>
</tr>
Run Code Online (Sandbox Code Playgroud) 我有一个问题可以改变渲染方法的频率.我找到了这个:
默认情况下,在libgdx中,呈现线程会连续调用ApplicationListener类的render()方法,其频率取决于您的硬件(每秒30-50-80次).我用
Gdx.graphics.setContinuousRendering(false);
Run Code Online (Sandbox Code Playgroud)
在我的create方法中,如果用户触摸屏幕,渲染就会停止并启动.但我希望以每秒1次的速度减慢频率.是否可以解决此问题,或者我只能使用render方法的默认设置.我搜索但没有找到解决方案.感谢帮助.