我有来自数据库(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)
小智 5
它对我有用:
<img class="info" th:attr="src=@{${image}}" />
Run Code Online (Sandbox Code Playgroud)
其中'image'是base64图片:
image ="data:image/png; base64,R0lGODlhlgCWAMQAAPz .........
在Spring Java Controller中:
@RequestMapping(value = "/get_goods_detail", method = RequestMethod.GET)
public String getGoodsDetail(@RequestParam(value = "itemid") final int itemid,
ModelMap model) {
// get image
String image = "data:image/png;base64,R0lGODlhlgCWAMQAAPz8/N3d3eX.../big image
model.addAttribute("image", image);
return "goods_detail"; // return name of html view with thymeleaf
}
Run Code Online (Sandbox Code Playgroud)
我不确定这会对你有帮助......
<tr th:each="sb, poz : ${product}">
<td th:text="${poz.count}">1</td>
<td><img th:attr="src=@{${sb.cover}} , title=#{background}, alt=#{background}" style="width: 150px; height: 150px;" /></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)
| 归档时间: |
|
| 查看次数: |
7346 次 |
| 最近记录: |