这是我的data.jsp,当我部署它时,它正常工作但当我试图通过url访问这个jsp时。这些是我添加到这个jsp的jstl ......
<!DOCTYPE html>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html lang="en">
它给了我以下例外。
Unterminated <form:option tag
--------------------------------
<tbody>
<tr>
<c:forEach items="${data}" var="data">
<td class="td-top td-left">
<form:select class="selectpicker form-control select-di" path="eastOrder" id="east-order" isChanged="false">
<form:option value="1" <c:if test="${data.order == '1'}">selected="true"</c:if>>1</form:option>
<form:option value="2" <c:if test="${data.order == '2'}">selected="true"</c:if>>2</form:option>
<form:option value="3" <c:if test="${data.order == '3'}">selected="true"</c:if>>3</form:option>
<form:option value="4" <c:if test="${data.order == '4'}">selected="true"</c:if>>4</form:option>
</form:select>
</td>
<td class="td-top">
<form:select class="selectpicker form-control select-cl" path="eastCl" id="east-cl" isChanged="false">
<form:option value="default"> </form:option>
<form:option value="x" <c:if test="${data.cl == 'x'}">selected="true"</c:if>>X</form:option>
<form:option value="y" <c:if test="${data.cl == 'y'}">selected="true"</c:if>>Y</form:option>
<form:option value="w" <c:if test="${data.cl == 'z'}">selected="true"</c:if>>Z</form:option>
<form:option value="z" <c:if test="${data.cl == 'w'}">selected="true"</c:if>>W</form:option>
</form:select>
</td>
</c:forEach>
</tr>
我该如何解决这个问题。提前谢谢。
答案 0 :(得分:1)
您可以使用EL三元运算符${condition?'true statement':'false statement'}
代替<c:if>
喜欢 -
<form:select class="selectpicker form-control select-di" path="eastOrder" id="east-order" isChanged="false">
<form:option value="1" ${data.order =='1'? 'selected="true"' : '' }>1</form:option>
<form:option value="2" ${data.order =='2'? 'selected="true"' : '' }>2</form:option>
<form:option value="3" ${data.order =='3'? 'selected="true"' : '' }>3</form:option>
<form:option value="4" ${data.order =='4'? 'selected="true"' : '' }>4</form:option>
</form:select>
答案 1 :(得分:0)
我有同样的问题,我通过在标签中使用标签解决,使用下面的代码作为参考:
你必须使用这段代码:
<h3 class="cor">
<?php
session_start();
$email = $_SESSION['email'];
require_once('conecta.php');
$pasta = "uploads/";
$objDb = new db();
$link = $objDb->conecta_mysql();
$consulta = mysqli_query($link, "SELECT * FROM arquivos WHERE email_vol = '$email'");
while ($resultado = mysqli_fetch_array($consulta)) {
$link = $pasta . $resultado["nomearq"];
$descr = $resultado["dataup"]." / " . $resultado["nomearq"];
echo "<a href='$link'>$descr</a><br>";
}
?>
</h3>
和
<%@ taglib prefix="c" uri="http://www.springframework.org/tags/form"%>
答案 2 :(得分:0)
我遇到了同样的问题,我用:
解决了 selected="${data.order =='1'? 'selected' : '' }"
您可以这样做:
<form:select class="selectpicker form-control select-di" path="eastOrder" id="east-order" isChanged="false">
<form:option value="1" selected="${data.order =='1'? 'selected' : '' }">1</form:option>
<form:option value="2" selected="${data.order =='2'? 'selected' : '' }">2</form:option>
<form:option value="3" selected="${data.order =='3'? 'selected' : '' }">3</form:option>
<form:option value="4" selected="${data.order =='4'? 'selected' : '' }">4</form:option>
</form:select>