Solved

Calling Java APIs from JSP

Posted on 2004-08-24
2
263 Views
Last Modified: 2010-04-01
I have available to me multiple Java APIs that I will be using to load and extract data from a XML file.  I need to access these Java APIs from a JSP page.  What is the best way, from a JSP page, to access Java APIs?

(The XML data is used to build a menu tree.  I am using Eclipse, and the myEclipse plugin.)  
 
As an aside, I'm not really asking for a lot of details and examples, (even though that would be VERY nice.)  I've read a lot (beans vs EJB vs embedded code, etc) and can't really pick out the best tools and approach.  If you can recommend an approach, I think it will save me from, say, implementing an approach only to find hours later some serious drawbacks!
0
Comment
Question by:LarryAndro
2 Comments
 
LVL 18

Assisted Solution

by:bobbit31
bobbit31 earned 100 total points
ID: 11883418
why not simply use page import:

<%@ page import="com.package.blah1,
             com.package.blah2"
%>
0
 
LVL 4

Accepted Solution

by:
hamood earned 150 total points
ID: 11883693
most of the java API can used on JSP pages by using page import directive in jsp. there is no restriction on it. Howerver if you want to use some other APIs. like type four 4 drivers of any other APIs then you have to add the jar files of these in the classpath of your jsp/servlet engine. or in the classpath of the application server which you are using. Once they are in the classpath of your server you can use them by using page import directive in your jsp.

Other method is to directly reference the class without importing it like

Java.Util.Vector vect = new Java.Util.Vector()
java.sql.Connection con;

in any case your claasses should be in your server classpath

Hamood
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

789 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