Updated: 2/23/2005; 1:45:14 PM.
Chris Schalk's J2EE Weblog
This Blog Discusses Tips and Tricks for building J2EE Web Applications with Oracle JDeveloper
        

Monday, October 13, 2003

A while back I wrote an article for Oracle Magazine on JSTL but I started receiving some questions on how to set up JDeveloper 903 to use JSTL.
So here's a simple "how to" which shows how to get JSTL running with Oracle9i JDeveloper 903.

Before I start, here's a quick FYI about JSTL and JfDeveloper 10g. JSTL is currently integrated into JDeveloper 10g Preview which is currently downloadable at OTN.

But for those who are still using the current production version of Oracle9i JDeveloper version 9.0.3, here's how to configure JDev to use JSTL.

1. First of all download JSTL 1.0 from Jakarta.apache.com. Save and extract this file to a subdirectory such as: d:\jstl104. (I'll be referring to this directory later on!)

2.Now launch JDeveloper 903. You will now add JSTL tag libraries to the Component Palette.

3. To test your work, create a new Workspace and a new Project. In the project create a new JSP. As the JSP appears in the editor so will the JSP Component Palette. (On the right side..)

4. If you're not familiar with the Component Palette, Get familiar with it! The Component Palette is the JSP developer's best friend! Notice the drop down list at the top of the Component Palette (CP)? This allows you to select different "Pages" of the palette and each page can contain tags from JSP tag libraries. (The CP also supports other components as well..)

5. Now let's add the "JSTL Core" tag library to JDeveloper. On the main menu select Tools->Manage Libraries. There you'll see all the libraries that JDev has configured. Click on the tab "JSP Libraries".

5. Now Click "New". Enter a location for the TLD. Click on the "Browse" button and locate the JSTL Core library's TLD file: "D:\jstl104\jakarta-taglibs-standard-1.0.4\tld\c.tld".

6. If all goes well the URI should automatically be filled in:"http://java.sun.com/jstl/core".

7. Now locate the taglib Archive. This is the Jar file that contains the JSTL tag handler classes: jstl.jar or: "D:\jstl104\jakarta-taglibs-standard-1.0.4\lib\jstl.jar".

8. Now set the prefix to "c" and click "Ok" to dismiss the wizard. Now JDeveloper is aware of this tag library. Our next step is to add a new Component Palette "page" and add this tag library to it.

9. On the Component Palette right-click and select "Properties". You can also use Tool->Configure Palette... on the menu. A dialog will appear which allows you to configure the Component Palette. First we'll add a new "Page" to the Palette. On the left side of the dialog click on "Add". Name the page "JSTL Core" and select a "jsp" page type.

10. On the right side of the same dialog click "Add..". You should see a new dialog asking to "Select a Tag..". You should see a tree with all of the JSP tag libraries. Locate the new JSTL tag library "c". Click on the tag library and click "Ok". Note: You don't need to drill down inside of the tag library, just click on "c" and click "Ok". You should see a confirmation message: "Install Tag(s)?", click "Yes". What this means is that it will install the entire JSTL Core tag library onto the Component Palette.

11. From now on when you edit a JSP you will have access to the JSTL Core tag library on the Component Palette.

Creating the JSTL System Library

Now that we've added the JSTL Core tag library we'll still need to make sure that we can compile a project with JSTL tags. For this we'll create a new JDeveloper library called "JSTL 1.0.4". This library will contain references to all of the required jar files for a JSTL application.

1. To create a new JDev Library, select Tools->Manage Libraries from the menu. This time we'll be creating a new "System Library". In the dialog click on the "System Library" node and click "New".

2. Name the library "JSTL 1.0.4".

3. For the Classpath, click on "Edit" and then "Add Entry".

4. Now locate the JSTL Home directory and find the required jar files.
D:\jstl104\jakarta-taglibs-standard-1.0.4\libdom.jar;
D:\jstl104\jakarta-taglibs-standard-1.0.4\libjaxen-full.jar;
D:\jstl104\jakarta-taglibs-standard-1.0.4\libjaxp-api.jar;
D:\jstl104\jakarta-taglibs-standard-1.0.4\libjdbc2_0-stdext.jar;
D:\jstl104\jakarta-taglibs-standard-1.0.4\libjstl.jar;
D:\jstl104\jakarta-taglibs-standard-1.0.4\libsax.jar;
D:\jstl104\jakarta-taglibs-standard-1.0.4\libsaxpath.jar;
D:\jstl104\jakarta-taglibs-standard-1.0.4\libstandard.jar;
D:\jstl104\jakarta-taglibs-standard-1.0.4\libxalan.jar;
D:\jstl104\jakarta-taglibs-standard-1.0.4\libxercesImpl.jar

Select all of these jar files and add them to this library. This single library will now contain all of these jar files. Click "Ok" twice to continue.

5. Our next step is to add our new "JSTL 1.0.4" library to our current project. This is done by double-clicking on the current project to edit it's project properties. In the "Available Libraries" locate "JSTL 1.0.4" and shuttle it over to the "Selected Libraries". This project should now compile when JSTL tag are added to any JSP page.

6. As a homework assignment, you can add the other JSTL libraries to the Palette.(fmt, XML ..)

7. A note on deployment. When you construct your deployment profile, be sure to include the JSTL jar files in the WEB-INF/lib sub directory so the app will still run in the deployed environment!

Well that about does it for getting JSTL to work with JDeveloper 9.0.3! Hope this help!

 


3:41:08 PM    comment []

Hello!
Welcome to my new Blog!

This blog will focus on visual Web development with Oracle JDeveloper.
Specifically I'll be sharing tips and tricks on how to build J2EE Web apps with the latest versions of JDeveloper. Some of the features I'll be providing help with are the upcoming visual JSP editor, Visual page flow designer, Struts, BC4J etc..

A little background on me...

My name is Chris Schalk and I am a product manager for Oracle JDeveloper. I happen to manage the Thin client development feature team which basically covers all of the thin client or Web development features..
In previous years I've been in software development and technical marketing roles at Oracle and IBM..

Thanks for looking me up! :)
I'll be posting as many Web development tips and tricks as I can....

Thanks,
-Chris
3:39:38 PM    comment []

© Copyright 2005 Chris Schalk.
 
October 2003
Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Sep   Jan


Search blog with Google:
 








Click here to visit the Radio UserLand website.

Subscribe to "Chris Schalk's J2EE Weblog" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.