Skip to main content



      Home
Home » Language IDEs » Eclipse Web Tools Platform Project (WTP) » When using the Jakarta Servlet in Eclipse 2022 -12, the JSP file will have errors
When using the Jakarta Servlet in Eclipse 2022 -12, the JSP file will have errors [message #1856696] Fri, 23 December 2022 03:49 Go to next message
Eclipse UserFriend
When I use Eclipse 2022-12 to import a web project using jakarta. servlet
Errors will occur in all jsp files
like this:
HttpServletRequest cannot be resolved to a type
javax.servlet cannot be resolved to a type
The superclass "javax.servlet.http.HttpServlet", determined from the Dynamic Web Module facet version (2.5), was not found on the Java Build Path

https://www.eclipse.org/forums/index.php?t=getfile&id=42798&

Although there are errors, it can still be started and run normally with tomcat

It seems that the problem from javax ->Jakarta
But for the same project, I did not have any errors in Eclipse 2022-03
Does anyone have the same problem?

Is this an Eclipse validation problem or is there something wrong with my project?


This is my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
    version="6.0">
......
......
</web-app>


This is the jakarta servlet api I use
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet.jsp</groupId>
            <artifactId>jakarta.servlet.jsp-api</artifactId>
        </dependency>

        <!-- Required only for Tomcat. If run on other J2EE server,
            remove this dependency and use provided tag libraries. -->
        <dependency>
            <groupId>jakarta.servlet.jsp.jstl</groupId>
            <artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
            <scope>runtime</scope>
        </dependency>

[Updated on: Fri, 23 December 2022 03:50] by Moderator

Re: When using the Jakarta Servlet in Eclipse 2022 -12, the JSP file will have errors [message #1856711 is a reply to message #1856696] Fri, 23 December 2022 11:27 Go to previous messageGo to next message
Eclipse UserFriend
It's probably better to ask on this more specific forum:

https://www.eclipse.org/forums/index.php?t=thread&frm_id=251
Re: When using the Jakarta Servlet in Eclipse 2022 -12, the JSP file will have errors [message #1856724 is a reply to message #1856711] Sat, 24 December 2022 20:39 Go to previous messageGo to next message
Eclipse UserFriend
Since there's no post there, I'll point out that the error message is telling you why it thinks you want to use the old package name: your project is set to expect Servlet (Dynamic Web Module facet) 2.5, not 5.0. Change it.
Re: When using the Jakarta Servlet in Eclipse 2022 -12, the JSP file will have errors [message #1856938 is a reply to message #1856724] Tue, 10 January 2023 04:29 Go to previous messageGo to next message
Eclipse UserFriend
Hi, Nitin Dahyabhai
My project uses 2.5. On the contrary, the error disappears when I use 5.0
This seems to be the opposite of the error message
Re: When using the Jakarta Servlet in Eclipse 2022 -12, the JSP file will have errors [message #1857559 is a reply to message #1856938] Wed, 15 February 2023 02:57 Go to previous messageGo to next message
Eclipse UserFriend
There seems to be some confusion here
Re: When using the Jakarta Servlet in Eclipse 2022 -12, the JSP file will have errors [message #1857585 is a reply to message #1856938] Wed, 15 February 2023 19:27 Go to previous message
Eclipse UserFriend
Yes, because it is checking for the new jakarta package when the project is set to 5.0, it would not complain about missing javax.servlet.http.HttpServlet.
Previous Topic:JSDT, unable to get types from IJavaScriptUnit
Next Topic:How to check the syntax of HTML files
Goto Forum:
  


Current Time: Wed Aug 20 18:23:16 EDT 2025

Powered by FUDForum. Page generated in 0.05544 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top