Yes, exactly.

But, I still have a problem. Here is my detail.....

I'm using Tomcat3.2.1 on WinNT4, with JDK1.3.
Under this path: <<tomcat_home>>\webapps\examples\jsp\happy, I have this
file,
*************************************
<!-- A JSP to test -->

<jsp:useBean id='happy' scope='page' class='Test' type='TestIF' />

<html>
<head>
<title>Test Bean</title>
</head>

<B>The result is: </B>  <jsp:getProperty name="happy" property="happy"/>
<B>Test database: </B>  <jsp:getProperty name="happy" property="database"/>

</html>
********************************
My interface is this:

//package examples;

import java.sql.*;

public interface TestIF {

public String getDatabase();
}

**************************

My Test class just implements the getDatabase method along with another
getter for happy. Without doing this interface business, I could get this to
run by having the; package examples; line in my Test.java.  And, having this
section in my JSP, class='examples.Test'

But, if I try to comment out the package declaration in my classes and go
with class='Test' type=..... in my JSP, it gives me this error:

Root cause:
java.lang.ClassNotFoundException: Unable to load class Test

I have a configuration problem somewhere. Any ideas?
I'm only worried about getting this simple interface example to work, then
I'll look at my design, coding style, etc....



------Original Message------
From: Alex Meyer <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: March 8, 2001 5:03:39 PM GMT
Subject: AW: Interfaces with JSP's


Yes, this is possible.

<jsp:useBean id="anyName" class="org.alexmeyer.AnyClass"
type="org.alexmeyer.AnyInterface" />

You can imagine this like:
AnyClass anyClass = (AnyInterface)new AnyClass();

Is this that what you mean???

Greetings Alex

+-----------------+
| Alexander Meyer |
+-----------------+--------------------------------+
| Sponackerweg 54                                  |
| 63808 Haibach                                    |
|                                                  |
| Tel. 0 60 21 / 61 05 35                          |
| E-Mail [EMAIL PROTECTED]                        |
| Homepage http://www.alexmeyer.org                |
|                                                  |
| Zertifikate:                                     |
| Brainbench Certified Master Java Server Pages    |
| (JSP 1.1) Developer                              |
| Brainbench Certified Master PHP 4 Developer      |
| Brainbench Certified Master JavaScript Developer |
| Brainbench Certified Master HTML 3.2 Developer   |
| Brainbench Certified Java 2 Developer            |
| Brainbench Certified XML Developer               |
| Brainbench Certified HTML 4 Developer            |
| Brainbench Certified WWW Concepts Architect      |
+--------------------------------------------------+


> -----Ursprungliche Nachricht-----
> Von: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]Im Auftrag von
> Ravi
> Gesendet: Donnerstag, 8. Marz 2001 07:25
> An: [EMAIL PROTECTED]
> Betreff: Re: Interfaces with JSP's
>
>
> Kevin
>
> the same question is Well explained in jguru.com jsp Faq's
> so why can't u have a look at it?
>
> ravi
>
>
> Kevin Kolle wrote:
>
> > I'm not sure if this is the correct mailing list for a JSP
> question, if not,
> > let me know.
> >
> > Is there a way to use an Interface called from within a JSP
> page with the
> > usebean tag? For example, I would like all gets and sets to go thru an
> > interface, then on the server side, the implementing class
> would take care
> > of the actual logic.
> >
> > Can I use interfaces with JSP's or does the class have to be a
> normal bean
> > class with getters and setters?
> >
> > ______________________________________________
> > FREE Personalized Email at Mail.com
> > Sign up at http://www.mail.com/?sr=signup
> >
> >
> __________________________________________________________________
> _________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> __________________________________________________________________
> _________
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html


______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to