Har*_*ara 5 javascript java exception thymeleaf
我在javascript使用中使用thymeleaf,th:inline="javascript"但是当我们在java脚本中添加布尔条件时,thymeleaf会出现如下异常:
org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 22; The entity name must immediately follow the '&' in the entity reference.
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1436)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEntityReference(XMLDocumentFragmentScannerImpl.java:1845)
.............................
Run Code Online (Sandbox Code Playgroud)
以下是我的javascript代码:
<script type="text/javascript" th:inline="javascript">
$(document).ready(function(){
$('.fancybox').fancybox({
'width' :'623px',
'maxHeight':'156px'
});
var catId = $("#category").val();
if(catId != null && catId != ''){
findSubCategories();
/*<![CDATA[*/
var subCatId = /*[[${searchProductDto.subCategory}]]*/
/*]]>*/
debugger;
if(subCatId != null){
$("#subCategory").val(subCatId);
}
}
});
...............................
Run Code Online (Sandbox Code Playgroud)
我们如何在百里香中使用&操作员?
Jay*_*ram 20
用<![CDATA[块包装if 块
<script type="text/javascript" th:inline="javascript">
var a =b = true;
/*<![CDATA[*/
if(a && b){
alert('Yea');
}/*]]>*/
</script>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3491 次 |
| 最近记录: |