我是thymeleaf的新手,正在尝试创建一个html表,其中的boolean值决定文本在某些列中的通过还是失败。
SmokeTest.passOrFailArray是布尔数组。现在,smokeTest.name显示在该列中,但是通过或失败的文本完全不显示。
这是我的thymeleaf / html代码
Smoke Tests
Test Name | Tests | |
A Smoke Test' |
这是我在百里香中用作变量的类
public testers() throws IOException { localPath = "/Users/dansbacher14/Documents/workspace/OBI_nightly_test/src/OBI_ci_scripts_tests"; remotePath = "ssh://git@stash.ops.aol.com:2022/obi/obi_ci_scripts.git"; localRepo = new FileRepository(localPath + "/.git"); pathToSmoke = "BPS/GPS/GATHR/SMOKE"; pathToODirectory = "test-results"; git = new Git(localRepo); } public staticvoid testClone() throws IOException, InvalidRemoteException, TransportException, GitAPIException { Git.cloneRepository().setURI(remotePath).setDirectory(new File(localPath)).call(); } //____________SETTERS AND GETTERS __________________________________________________________________________________ public void setName(String name) { jmxName = name; } public String getName() { return jmxName; } public boolean[] getPassOrFailArray() { return passOrFailArray; } public String getLocalPath() { return localPath; }
}
这是浏览器显示源代码的方式。
Smoke Tests
Test Name | OBI01 | DEV |
authAmtTesting.jmx | ||
authTesting.jmx | ||
CC_Crypto.jmx | ||
ci_address.jmx | ||
ci_cardtype_negative.jmx | ||
ci_cardtype_positive.jmx | ||
promoSmokeTst.jmx | ||
tokenizedPayment.jmx |
是否可以在百里香中做这样的事情?如果可以,我该如何进行这项工作?谢谢
此代码有效
<th:block th:each="pf : ${smokeTest.passOrFailArray}"> <td th:if="${pf} == true" th:text="Passed"></td> <td th:if="${pf} == false" th:text="failed"></td> </th:block>
问题是我在每个循环中错误地命名了我的变量。名称中不能包含句点。