今天使用c:choose标签,一直报错:
严重: Servlet.service() for servlet CheckIncome threw exception
org.apache.jasper.JasperException: <h3>Validation error messages from TagLibraryValidator for c in /hk_life/income_balance/Balance_day.jsp</h3><p>73: Illegal text inside "c:choose" tag: " ...".</p>
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:74)
at org.apache.jasper.compiler.Validator.validateXmlView(Validator.java:1845)
at org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1791)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
网上查了一下,Illegal text inside "c:choose" tag 这个错误,只需要将c:choose标签之间的空格和换行去掉即可
报错的代码:
<c:choose>
<c:when test="${ss.result_code == 0}">
成功
</c:when>
<c:otherwise>
失败
</c:otherwise>
</c:choose>
修改后的代码:
<c:choose><c:when test="${ss.result_code == 0}">成功</c:when><c:otherwise>失败</c:otherwise></c:choose>