• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

jstl.jar and jstl-api.jar

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In some maven web projects, I see different jstl related jars.  In one pj, I see

<groupId>jstl</groupId>
<artifactId>jstl</artifactId>

But in another project, I see

<groupId>org.glassfish.web</groupId>
<artifactId>javax.servlet.jsp.jstl</artifactId>

<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>javax.servlet.jsp.jstl-api</artifactId>

I omitted the version part for simplicity.
What confuse me is

1) what is jstl-api.jar for ?
2) why in the first project, it works fine without jstl-api.jar,  but in the second project it uses a combination of them ?
3) For jstl.jar, the second one is clear it is from "javax.servlet.jsp", but the first one is just "jstl", sounds strange.
 
Linwood Hayes
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
don't know why.  i posted earlier, not sure how it appeared again.
 
Saloon Keeper
Posts: 23544
161
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSTL, like certain other JEE components, is comprised of two separate libraries: an API jar and an implementation jar.

The API jar defines the Application Programming Interface - the classes that your webapp uses to talk to the component in question. Most of these classes are Interfaces and specifically Interfaces defined by the JEE standard.

The Implementation jar does the actual work. It contains the classes which implement the API.

For JSTL, as for JSP, the API and Implementation jars are supplied as part of the web application server. The Implementation jars have no business whatever being invoked in a webapp POM, as they are appserver-specific. The API jars are not appserver-specific, and in fact, that's the very reason for having a separate API and implementation - to make webapps more "write-once/run-anywhere". In a Maven POM, the scope of the API jar should be "provided", since at run-time, the copy of the API jar that's internal to the webapp server should be used. Note that if you don't define a scope in Maven, it will default to "compile" and that can lead to trouble here.

Not everything you read on the Internet is correct, so the example that you cited is not a good example.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic