Solved

Absolute URL includes with JSP

Posted on 2002-03-19
6
552 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now