facebook

JSP Validation problem; 2 warnings

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #286474 Reply

    Hi,

    The following piece of code gives me 2 warnings:

    <% if (true) { %>
    <html>
    <head>
    <title>
    title
    </title>
    </head>
    <body>
    body
    </body>
    </html>
    <% } else { %>
    <html>
    <head>
    <title>
    title
    </title>
    </head>
    <body>
    body
    </body>
    </html>
    <% } %>

    The warnings:

    1) Duplicate tag (html)
    2) Empty block should be documented (twice).

    I know a workaround for the first warning (simply put the html tag outside the if-statement), but isn’t it possible to make the validator a little bit smarter?

    I also know a workaround for the second warning (put /* no problem */ after each { ), or set the validation option (Java > Compiler > Errors/Warnings > Code Style > Undocumented empty block) to ignore in the settings, but this is not really an option for me (I’m using this option in java code with great success).

    My MyEclipse info:

    *** Date:
    Monday, June 30, 2008 10:33:04 AM CEST

    ** System properties:
    OS=WindowsXP
    OS version=5.1
    Java version=1.5.0_11

    *** MyEclipse details:
    MyEclipse Enterprise Workbench
    Version: 6.0.1 GA
    Build id: 6.0.1-GA-200710

    *** Eclipse details:
    MyEclipse Enterprise Workbench

    Version: 6.0.1 GA
    Build id: 6.0.1-GA-200710

    Eclipse Platform

    Version: 3.3.3.r33x_r20080129-_19UEl7Ezk_gXF1kouft
    Build id: M20080221-1800

    Eclipse RCP

    Version: 3.3.3.r33x_r20080129-8y8eE9UEUWI6qujeED0xT7bc
    Build id: M20080221-1800

    Eclipse Java Development Tools

    Version: 3.3.2.r33x_r20080129-7o7jE7_EDhYDiyVEnjb1pFd7ZGD7
    Build id: M20080221-1800

    Eclipse Plug-in Development Environment

    Version: 3.3.3.r33x_r20080129-7N7M5DQVIA_6oJsEFkEL
    Build id: M20080221-1800

    Eclipse Project SDK

    Version: 3.3.3.r33x_r20080129-7M7J7LB-u3aphGW6o3_VmiVfGXWO
    Build id: M20080221-1800

    Eclipse Graphical Editing Framework

    Version: 3.3.1.v20070814
    Build id: 20070814-1555

    Eclipse startup command=-data
    C:\temp24\test
    -os
    win32
    -ws
    win32
    -arch
    x86
    -showsplash
    -launcher
    C:\development\MyEclipse\eclipse\eclipse.exe
    -name
    Eclipse
    –launcher.library
    C:\development\MyEclipse\eclipse\plugins\org.eclipse.equinox.launcher.win32.win32.x86_1.0.3.R33x_v20080118\eclipse_1023.dll
    -startup
    C:\development\MyEclipse\eclipse\plugins\org.eclipse.equinox.launcher_1.0.1.R33x_v20080118.jar
    -exitdata
    e94_d0
    -vm
    C:\development\MyEclipse\jre\bin\javaw.exe

    Thanks in advance,

    Teun Hoogendoorn

    #286515 Reply

    Loyal Water
    Member

    Im afraid that you will have to turn off the HTML validator or mark that individual file excluded from validation completely to overcome this issue. The HTML validator isn’t aware of JSP logic constructs, like if/else, so it doesn’t see that you only have one resultant tag set… it just sees duplicates

    #286537 Reply

    Hi Nipun,

    Thanks for your response.

    The piece of code I’ve posted is jsp content, placed in a .jsp file.

    If I turn off the HTML syntax validator, the warning about the duplicate html tag isn’t going away. If
    I turn off the JSP content validator it’s gone (I have tested this multiple times). Is this also a problem
    of the JSP content validator? This validator should be aware of JSP logic contructs, or am I missing
    something?

    Have you already looked into my second “warning” problem: Empty block should be documented?

    Thanks,

    Teun Hoogendoorn

    #286578 Reply

    Loyal Water
    Member

    Have you already looked into my second “warning” problem: Empty block should be documented?

    I was unable to reproduce the 2nd warning using the code that you have provided. What line are you getting the error at? Can you give me any other example that can be used to reproduce this.

    #286616 Reply

    Hi Nipun,

    I’m getting the warnings (Empty block should be documented) at line 1 and line 12.

    Another example (just one line):

    <% if (true) { %><html></html><% } %>

    Warning at line 1: Empty block should be documented

    This warning only appears if you have the following settings:

    1) Window > Preferences > Java > Compiler > Errors/Warnings > Code Style > Undocumented empty block: Warning
    2) Turn on the JSP Syntax Validator

    Thanks again,

    Teun Hoogendoorn.

    #286699 Reply

    area62
    Member

    I have the same problem here! But it’s also a bit strange that he only gives a warning for the <html> tag and not the <head>, <title> and <body> tag.

    #286720 Reply

    Loyal Water
    Member

    I just checked with my dev team and the comment-empty-block issue is a known issue we hope to fix in 7.0

    As for the validator issue, after further investigation we are going to try and see if we can get these fixed for 7.0.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: JSP Validation problem; 2 warnings

You must be logged in to post in the forum log in