Maven Dependency for Spring and Portlet tags

☆樱花仙子☆ 提交于 2019-12-11 06:04:33

问题


I have this following problem in Netbeans IDE - when I create a JSP file and put these two taglibs inside

<%@taglib prefix="portlet" uri="http://java.sun.com/portlet_2_0" %> 
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

then I get error The absolute uri ... cannot be resolved. So I am wondering where could be the problem?Application is working correctly when is deployed to AS but I would like to enjoy things like autocompletion during development. My pom.xml looks like this - PasteBin.

I suppose I have all the necessary JARs on classpath so how can I make NetBeans to recognize those tags?


回答1:


To use sprint tags it enough to declare one spring dependency

   <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc-portlet</artifactId>
        <version>3.0.6.RELEASE</version>
    </dependency>

Spring downloads other dependencies automatically. All dependency list for spring portlet you can see here

With portlet tags a little more complicated, I still can't find dependency for portlet taglib and I always copy portlet_2_0.tld to my WEB-INF/tld folder, if you find this dependency let me know. Thanks.




回答2:


To fix the portlet TLD problem add this to your POM

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

The scope of provided is important - bear in mind you just want this to be included for validating in your IDE. The portlet TLD will be provided by whichever JSR-286 implementation you are deploying to e.g. Liferay, uPortal etc.

NB this worked for me in Eclipse, I presume it will also do the trick in NetBeans.



来源:https://stackoverflow.com/questions/14952102/maven-dependency-for-spring-and-portlet-tags

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!