Reputation: 1457
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>
Upvotes: 2
Views: 990
Reputation: 2949
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>
Upvotes: 1
Reputation: 291
Enclose your JavaScript into a CDATA
block:
<script type="text/javascript">
<![CDATA[
var javascript;
]]>
<script>
Upvotes: 1