Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL in JSP  RSS feed

 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am looking at JSP page, which has code line as follows


This taglib will have to be installed on local environment. How is it referred in jsp ? I dont see any code in jsp, which refers to the location of JSTL. So how does jsp invoke these tags ? Is it through classpath ?
If its so , how is classpath set for JSTL ? Is it just as classpath is set for java ?

Thanks
 
Swastik Dey
Rancher
Posts: 1782
14
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The classpath for any web application is WEB-INF\lib. So, you should keep the library file there.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Those are Struts libraries. They have nothing at all to do with the JSTL.
 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My mistake, this is struts.
but confusion still remains, how is it referred in JSP ? I dont see any code, where this classes are called in JSP page. So are these strut classes specified in classpath OR is there another mechanism ?

thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The taglib declaration uses the URI to find the matching jar file in the class path and match up the prefix to it. There doesn't need to be any code (there should never be any code) in the JSP page to use it.

Note that the URI is not a location. It's just a string that just happens to look like a URL.
 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is where I am getting confused.

<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>

Do you mean to say, whenever jsp page with above code is loaded, it will make call to http://jakarta.apache.org/struts/tags-bean and load tags-bean from there ?

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While "make a call" isn't the right terminology, essentially yes.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!