Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 08:49 Go to next message
panda mkk is currently offline panda mkkFriend
Messages: 38
Registered: April 2022
Member
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 08:50]

Report message to a 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 16:27 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33145
Registered: July 2009
Senior Member
It's probably better to ask on this more specific forum:

https://www.eclipse.org/forums/index.php?t=thread&frm_id=251


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: When using the Jakarta Servlet in Eclipse 2022 -12, the JSP file will have errors [message #1856724 is a reply to message #1856711] Sun, 25 December 2022 01:39 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4438
Registered: July 2009
Senior Member

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.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
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 09:29 Go to previous messageGo to next message
panda mkk is currently offline panda mkkFriend
Messages: 38
Registered: April 2022
Member
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 07:57 Go to previous messageGo to next message
Shara hall is currently offline Shara hallFriend
Messages: 1
Registered: February 2023
Junior Member
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] Thu, 16 February 2023 00:27 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4438
Registered: July 2009
Senior Member

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.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:JSDT, unable to get types from IJavaScriptUnit
Next Topic:How to check the syntax of HTML files
Goto Forum:
  


Current Time: Sun May 05 20:54:02 GMT 2024

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

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

Back to the top