Solved

Calling Java APIs from JSP

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
password protect pdf 11 74
nested if has else if 13 92
build fail in maven project 11 179
I get error: useBean: Duplicate bean name: {0} 1 121
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
There are many Password Managers (PM) out there to choose from. PM's can help with your password habits and routines, but they should not be a crutch you rely on too heavily. I also have an article for company/enterprise PM's.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 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

12 Experts available now in Live!

Get 1:1 Help Now