ME 9.1 How to disable Javascript validation in JSP files?

This topic contains 3 replies, has 2 voices, and was last updated by Profile photo of support-swapna support-swapna 6 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #320270 Reply

    I just upgraded to 9.1 from 8.6 and I’m seeing lots of error and warnings in Javascript that is in script tags in JSP files.

    I’m using struts 2 tags to conditionally generate js code so I understand the js validator will think it’s invalid.

    I’ve tried turning off all the validation settings I can find for both JSP and for Javascript and have not found anyway to get rid of these errors. I’ve seen in the Eclipse forums that you can disable the “Javascript validator” from the Project > builders panel but when I go there I don’t find a “Javascript validator”.

    Additionally, if I right-click on the project or folder and select “MyEclipse > Remove All Validation Markers” the errors are *NOT* removed. This makes me think these errors are coming from the base Eclipse validators.

    So how do I disable these errors?

    Below is a sample of the problem with the errors marks as comments. I know the ERROR’s are not valid JS but the WARNING is.

    <script type=”text/javascript”>
    // <![CDATA[

    // ERROR [Syntax error on token “<“, delete this token] Type=JavaScript Problem
    // ERROR [Syntax error on token “if”, ( expected after this token] Type=JavaScript Problem
    <s:if test=”%{!routeIsTrashed}”>
    function toggleActiveImage() {
    // function body

    // WARNING: [Missing semicolon] Type=JavaScript Problem
    $(“#deleteUserButton”).button({icons: { primary: ‘ui-icon-trash’}});

    // ]]>

    #320291 Reply
    Profile photo of support-swapna

    glindholm ,

    Sorry that you are seeing this issue with MyEclipse. Here are the ways to disable JavaScript validation :

    1) To disable validation, you should be able to go to Project Properties > MyEclipse > Validation > Excluded Resources and check the tree you wish to exclude.

    2) You can right click on the folder or individual JS resource and select MyEclipse -> Exclude from validation.Once you select the Exclude from Validation, you need to make a change and then save the js file to remove the errors. Ex : Hit space and then save it.

    3) You can globally disable the javascript validator from Window > Preferences > MyEclipse > Validation. Uncheck both the boxes for ‘JavaScript Validator for JS Files’. This will trigger a full project rebuild, after which, JavaScript validation will be globally disabled.You can also disable ‘Struts 2 Validator’ in the same lines, you will need to restart your workspace for it to remove the error markers from files that had already been validated before you turned it off.

    Let us know how it works for you.

    #320316 Reply

    I tried #3 and it did not make any difference.

    Again: The Javascript that is causing the problem is not is a separate js file, it’s embedded in <script> tags within JSP files.

    I don’t really want to exclude the file from validation, I would just like to turn off the javascript validation in JSP files.

    I’m reworking the javascript code to not use conditional jsp tags, this will get rid of the errors.

    However, I’m still seeing a log of bogus warning messages in the javascript, mostly “Missing semicolon” warnings on javascript Object Literals.

    // WARNING: [Missing semicolon] Type=JavaScript Problem
    $(“#deleteUserButton”).button({icons: { primary: ‘ui-icon-trash’}});

    #320343 Reply
    Profile photo of support-swapna

    glindholm ,

    I am afraid I could not replicate the issue after I turned off JavaScript Validation on JS files.

    1) Can you share your Build ID from Help > About MyEclipse Enterprise Edition > Build ID ? Paste the Build ID here. Also share your OS version details.

    2) Once you turn off the validation, it will prompt for a full rebuild. Can you check if there are any related errors logged in the .log file which is located at <workspace dir>/.metadata/.log during the rebuild ?

    3) Can you switch to a new workspace, turn off the ‘JavaScript Validator for JS files’ and check if the issue persists ?

    Attached is the screenshot of the Validation under Preferences. Let me know how it works for you.

    You must be logged in to view attached files.
Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: ME 9.1 How to disable Javascript validation in JSP files?