Solved

Absolute URL includes with JSP

Posted on 2002-03-19
6
566 Views
Last Modified: 2013-11-24
My group is working on using JSP includes to make a webpage template. We want to use some absolute URL includes in the template but with testing and a review of Sun's JSP documentation website, the two available include commands do not support absolute URLs.

Is there a work around or do we have to make a local copy of the contents of the absolute URL (which we do own)?

P.S. We use variables to store the include values whether they are local webpages or absolute urls. We then use the include functions to call the variable.
0
Comment
Question by:daluu
  • 4
  • 2
6 Comments
 
LVL 6

Expert Comment

by:kotan
ID: 6881692
<jsp:include> only supports the inclusion of resources within the same web application.

Anyway, to support this ficture, you can use "standard Taglib" from Jakarta project.

Here is the url to download standard taglib package.
http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html

In this taglib, you can write
  <c:import url="ftp://ftp.acme.com/README"/>
to include external rescoures.

For further documentation, please refer

http://jakarta.apache.org/taglibs/doc/jsptl-doc/IOT_Import_FunctionalDescription_5_EA2.html

If you don't know how to use taglib, feel free to ask me and I will guide you.
0
 
LVL 4

Author Comment

by:daluu
ID: 6883746
thanks, for the info, I'll try that out.
0
 
LVL 4

Author Comment

by:daluu
ID: 6884595
kotan, can you guide me thru the steps from install to usage. I am the web designer and just learning JSP. My colleague who manages the server and does JSP couldn't get it to work with the online documentation. I'll post her comment to me below.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Author Comment

by:daluu
ID: 6884597
hi david,

i've downloaded the standard library and tried to use it as per the
instruction but failed.
i found several instruction files and they give different usage and no one
could work.
could you send email to that guy to ask for detail steps? from download the
files to the usage? the following is my steps:
1, downloaded the jakarta-taglibs-20020316.zip file
2, extracted it
3, found the folder 'standard', and copy the standard.jar and jstl.jar into
the /<Tomcat 4.0>/WEB-INFO/lib/
4, in the /<Tomcat 4.0>/WEB-INFO/web.xml, added
    <taglib>
     <taglib-uri>http://java.sun.com/jstl/ea/core</taglib-uri>
     <taglib-location>/WEB-INF/c.tld</taglib-location>
    </taglib>
I couldn't find the standard.tld file in the 'standard' folder.
5, in my.jsp file, added
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
6, error:
Unable to load class org.apache.taglibs.standard.tag.el.core.ImportTag

jessie
0
 
LVL 6

Accepted Solution

by:
kotan earned 50 total points
ID: 6884691
1. He had download "nightly build" version which is very unstable. If you only need the standard package, you can download jakarta-taglibs-standard-beta1.zip from http://jakarta.apache.org/builds/jakarta-taglibs/releases/standard/ which is "release" version and it is more stable.

2. extracted it

3. copy standard.jar & jstl.jar from /jakarta-taglibs/jstl-beta1/ into /<Tomcat4.0>/WEB-INF/lib/

4. copy c.tld into /<Tomcat4.0>/WEB-INF/

5. Edit web.xml - add

<taglib>
  <taglib-uri>http://jakarta.apache.org/taglibs/standard/c</taglib-uri>
  <taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>

6. In jsp file, add
<%@ taglib uri="http://jakarta.apache.org/taglibs/standard/c" prefix="c" %>

(The uri must be same as the taglib-uri define in web.xml)

7. Then you will be able to call
 <c:import url="ftp://ftp.acme.com/README"/>

Since you have upload new jar files, remmeber to restart tomcat to take effect.

Good Luck!
0
 
LVL 4

Author Comment

by:daluu
ID: 6887257
Thanks alot kotan.

The code works perfect. My superiors will be happy.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
firstswap challenge 20 84
github account with ecipse 1 56
HTTPSessionBindingListernter not configured in deployment descriptor 2 70
java jdbc batch example 8 49
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will learn how to count occurrences of each item in an array.

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question