Solution to the unavailability of jstl tag library in maven project

Failed to introduce jstl tag library in maven project?

I created the maven project and configured the dependency of the jstl tag library, but it still didn't work, and the JSP page still gave me the output as it is. If you also encounter this problem, be sure to slide your finger to check in.

What was my mood at the time?
Insert picture description here

At first, I thought it was the wrong version that I imported. Later, I changed it to 1.2 and it still didn’t work. I looked at the dependency package and it was also imported. It was puzzling. Later, Baidu found
out the configuration in web.xml . File problem.

So if you encounter a problem, it’s Baidu. Don’t keep tossing about the problem yourself. Maybe other people have encountered the problem you have encountered, and provide solutions for your reference.

Ok i officially start

Now add the following test content to the index.jsp page,
Insert picture description herebut the page does not parse my jstl tag but directly outputs it as it is, and my code does not report an error.
Insert picture description here

The output result is like this: output as it is.
Insert picture description here My mentality at this time is super explosive.
I suspect the reason for the idea. For a while, I suspect that there is a problem with the dependency package, and for another, I suspect that there is a problem with the local warehouse.

I looked at my web.xml configuration file under WEB-INF and found that the header information is 2.3, because version 2.3 may not add this line of code to the jsp page by default:

<%@ page isELIgnored="false" %>

So it won't parse the jstl tag for me

Insert picture description here
Solution 1:

Which line of code is added to each jsp page, but this scheme is more troublesome, it is recommended to use scheme two

Solution 2:

Just change the header information of web.xml to a higher version. I used toncat8, so I used 2.4. Here you need to correspond to your toncat version.

2.4 web.xml header information is as follows: just paste and copy over the original.

       <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
          http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
</web-app>

After
Insert picture description here
the modification: Successful output After a long time, my mood is like this after successful output. Finally, I hope to help everyone.

Insert picture description here

Guess you like

Origin blog.csdn.net/m0_46188681/article/details/110698775