Problem in web.xml

Asked

Viewed 328 times

1

Hello!

I have my web.xml, I want to put the jstl dependency, for this I am using the following code:

<dependency>
    <groupId>jstl</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
    <type>jar</type>
</dependency>

But Netbeans is showing the following message:

cvc-Complex-type.2.4. a: Invalid content detected starting with the dependency element. One of the expected '{"http://java.sun.com/xml/ns/javaee":Description, "http://java.sun.com/xml/ns/javaee":display-name, "http://java.sun.com/xml/ns/javaee":icon, "http://java.sun.com/xml/ns/javaee":distributable, "http://java.sun.com/xml/ns/javaee":context-param, "http://java.sun.com/xml/ns/javaee":filter, "http://java.sun.com/xml/ns/javaee":filter-Mapping, "http://java.sun.com/xml/ns/javaee":Listener, "http://java.sun.com/xml/ns/javaee":Servlet, "http://java.sun.com/xml/ns/javaee":Servlet-Mapping, "http://java.sun.com/xml/ns/javaee":Session-config, "http://java.sun.com/xml/ns/javaee":mime-Mapping, "http://java.sun.com/xml/ns/javaee":Welcome-file-list, "http://java.sun.com/xml/ns/javaee":error-page, "http://java.sun.com/xml/ns/javaee":jsp-config, "http://java.sun.com/xml/ns/javaee":security-Constraint, "http://java.sun.com/xml/ns/javaee":login-config, "http://java.sun.com/xml/ns/javaee":security role, "http://java.sun.com/xml/ns/javaee":env-entry, "http://java.sun.com/xml/ns/javaee":ejb-ref, "http://java.sun.com/xml/ns/javaee":ejb-local-ref, "http://java.sun.com/xml/ns/javaee":service-ref, "http://java.sun.com/xml/ns/javaee":Resource-ref, "http://java.sun.com/xml/ns/javaee":Resource-env-ref, "http://java.sun.com/xml/ns/javaee":message-Destination-ref, "http://java.sun.com/xml/ns/javaee":persistence-context-ref, "http://java.sun.com/xml/ns/javaee":persistence-Unit-ref, "http://java.sun.com/xml/ns/javaee":post-construct, "http://java.sun.com/xml/ns/javaee":pre-destroy, "http://java.sun.com/xml/ns/javaee":message-Destination, "http://java.sun.com/xml/ns/javaee":locale-encoding-Mapping-list}'. [40]

Saying the file is invalid

  • 1

    Your dependencies should go on pom.xml, not in the web.xml.

  • I have to create a file called pom.xml?

  • I don’t use Netbeans, so I don’t know what the file structure of a project looks like in it, but if you created a Maven-project there must be a pom.xml somewhere. Take a look in that guide and see if he helps you.

  • I have not created a Maven, I am not yet at this level

1 answer

1


If you have not created a Maven project, you should include the JSTL manually. To do this, simply access the JSTL On Maven, choose the version and click on Download JAR.

Repository JSTL MAVEN.

Then choose the version, the most used at this time is the 1.2. Passo 1 para adicionar JSTL manualmente.

The next step is to lower the JSTL JAR. inserir a descrição da imagem aqui

Finally, just add the downloaded JAR to the folder lib of your project and link it through the project properties.

Right click on the project>Properties>Libraries>Add JAR/FOLDER>Find JSTL JAR.

All right, you’ll get the JSTL added to your project.

Now just use it on JSP with the following line.

<%@taglib  prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

So you can use the tag <dependency> you need to start a MAVEN project.

  • Whether it was because I added jstl to the server instead of using it in the application?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.