IntelliData
IntelliData

Reputation: 432

IntelliJ IDEA not recognizing <%@taglib uri="/struts-tags" prefix="s"%>' directive

I am aware that this this question is a duplicate; however, since the accepted answer did not solve my problem, I am taking the liberty of re-asking it.

On every JSP that has abovementioned directive, I get this error:

Cannot resolve taglib with uri /struts-tags

As suggested in the other post, I tried:

  1. Adding struts facet.
  2. Invalidating cache and restarting the IDE.

Both did not help. Any Ideas?

Edit:

Here is the screenshot as requested:

Here is the screenshot as requested

Edit 2:

here is my web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Stuhrling Central</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  
  
  <session-config>  
        <session-timeout>  
            120  
        </session-timeout>  
    </session-config>
    
  <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  </filter>

  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
 
</web-app>

Upvotes: 0

Views: 1867

Answers (1)

Roman C
Roman C

Reputation: 1

The file IntelliJ IDEA is looking is

C:\Users\Mwaldner\.m2\repository\org\apache\struts\struts2-core\2.3.24\struts2-core-2.3.24.jar!\META-INF\struts-tags.tld

Inside it you can find a tag

<uri>/struts-tags</uri>

The following dependencies should be in your pom.xml:

<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>2.3.24</version>
</dependency>

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

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

In web.xml you shouldn't redefine struts.tld. Such as using <jsp-config>.

If IntelliJ IDEA can't find this file then you have the following options:

  • Check the core jar file has a correct SHA1/MD5 checksum.
  • Create a new project or use a blank application
  • Update IntelliJ IDEA to resolve known bugs.

Upvotes: 0

Related Questions