Solved

Calling Java APIs from JSP

Posted on 2004-08-24
2
258 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

706 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

15 Experts available now in Live!

Get 1:1 Help Now