Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

jstl.jar and jstl-api.jar

 
Ranch Hand
Posts: 155
  • 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: 155
  • 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: 25463
180
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.
 
I'm still in control here. LOOK at this tiny ad!
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic