JSP文件中的Eclipse和struts语法错误 [英] Eclipse and struts syntax errors in JSP files
问题描述
例如。我的标签< logic:equal
显示此错误
令牌上的语法错误 <,删除此令牌
但该页面工作正常。在这些情况下,如何获取eclipse不显示错误?
编辑:只是注意到这只是当标签位于< script> ;
块。标签中的HTML正常工作正常。这只是我的eclipse版本的一个未解决的错误吗?
编辑2:发布一个代码块的评论。还将响应建议的CDATA添加到文件中。我仍然在eclipse中收到错误。
< script type =text / javascriptlanguage =Javascript1.2 >
//<![CDATA [
window.onload = function()
{
<逻辑:等值=falsename =BeanKeyproperty =值(RecordNotFound)>
alert(未找到记录);
< / logic:equal>
}
//]]>
< / script>
相反,您可以这样尝试,
< logic:present name =BeanKeyproperty =value(RecordNotFound)>
< logic:equal value =falsename =BeanKeyproperty =value(RecordNotFound)>
< script>
window.onload = function()
{
alert(Record not found);
}
< / script>
< / logic:equal>
< / logic:present>
I'm using eclipse as my java IDE and the project I'm working on uses struts. Eclipse is telling me on any page that has struts tags that the tags are syntax errors.
E.g. my tag <logic:equal
shows this error
Syntax error on token "<", delete this token
but the page works just fine. How can I get eclipse to not show errors in these cases?
EDIT: Just noticed this is only when the tag is inside a <script>
block. Tags in regular HTML work fine. Is this just an unresolved bug with my version of eclipse?
EDIT 2: posting a code block per the comment. Also added the CDATA to the file like the response suggests. I'm still getting the error in eclipse.
<script type="text/javascript" language="Javascript1.2">
//<![CDATA[
window.onload = function ()
{
<logic:equal value="false" name="BeanKey" property="value(RecordNotFound)">
alert("Record not found");
</logic:equal>
}
//]]>
</script>
Instead you can try like this,
<logic:present name="BeanKey" property="value(RecordNotFound)">
<logic:equal value="false" name="BeanKey" property="value(RecordNotFound)">
<script>
window.onload = function ()
{
alert("Record not found");
}
</script>
</logic:equal>
</logic:present>
这篇关于JSP文件中的Eclipse和struts语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!