Solved

Absolute URL includes with JSP

Posted on 2002-03-19
6
574 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

688 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