Mysterious Eclipse JSP Validation Errors

前端 未结 16 1957
你的背包
你的背包 2021-01-30 08:50

Eclipse (Helios) occasionally marks valid looking JSP content as having errors. It seems like it often breaks when I use the tag. For example, in a JSP with just th

相关标签:
16条回答
  • 2021-01-30 09:07

    Well, I found how to solve this error. Add this to your Maven dependency(pom.xml):

    <!-- dependency to fix JSPServletException -->
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>jsp-api</artifactId>
            <version>6.0.32</version>
            <scope>provided</scope>               
        </dependency>
    

    Do comment if you find it useful, as much as it helped me.

    0 讨论(0)
  • 2021-01-30 09:07

    You need to include jap-api.jar in your classpath.

    0 讨论(0)
  • 2021-01-30 09:10

    Based on the comments, I ended up turning off part of the JSP validation, which fixed this.

    1. Go to "Project->Properties->Validation".
    2. Click "Configure Workspace Settings...".
    3. Unselect options for JSP Syntax Validator (both manual and build).

    I was hoping I was missing something and there was a way to fix this, but I have to concede that the JSP validation is junk.

    0 讨论(0)
  • 2021-01-30 09:13

    A much easier way is to

    select the project -> Properties -> Java Build Path -> Libraries Tab

    Select add Libraries. From there select Server Runtime. It will list all the server runtimes you have configured. From there Select the server runtime you have assosiated your project with.

    This will rebuild and revalidate the projece and all this ghost errors will be removed.

    Hope this helps.

    0 讨论(0)
  • 2021-01-30 09:14

    I had the same problem and eventually got it to work by switching (with Maven) to version 2.3 of the servlet-api:

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.3</version>
        <scope>provided</scope>
    </dependency>
    

    Apparently 2.4 and higher don't have javax.servlet.jsp build in anymore. You might be able to find that library in another package if you still want to use 2.4 or higher.

    0 讨论(0)
  • 2021-01-30 09:15

    Adding jsp-api.jar into your build classpath would fix it. jsp-api.jar is under common\lib for tomcat 5.x

    0 讨论(0)
提交回复
热议问题