Hmmm.. I tried that too.  The compiler doesn't croak on the import
statement, but, it doesn't lile the statement where I call one of the
method's of the user-defined (unnamed package) class.
    So, my question is: "Is there any way to instantiate and use a unnamed
package class in a named package class?"  I know that this is a fundamental
Java Question, rather than a JSP one.. So, sorry...

Thanks,
Shrisha

----- Original Message -----
From: "Hans Bergsten" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 09, 2000 11:57 AM
Subject: Re: JSP/Package problem


> Shrisha Radhakrishna wrote:
> >
> > Hi All,
> >     I have a very strange/painful problem.  Ok, here I go.  I use
Weblogic
> > 4.5.1 to host my JSPs.  The compiler adds a "package jsp_servlet;" to
all my
> > JSP's when they are converted into servlets.  So, in other words all my
JSPs
> > are in jsp_servlet package.  Now, I want to instantiate a user-defined
> > class, say x, (that is not in ANY package) from within my servlet.  So,
a
> > statement in my JSP would be something like:
> >
> > x temp=new x();
> >
> > The compiler throws a error that says jsp_servlet.x not found in import.
> > Obviously, its looking for x within the jsp_servlet package.  How do I
> > access the default package from within my servlet?
>
> This is the way Java works when you use a class in the unnamed package
> in another class in a named package. To solve it you must use an import
> statement for the class in the unnamed package, i.e.
>
>   <%@ page import="x" %>
>
> Hans
> --
> Hans Bergsten           [EMAIL PROTECTED]
> Gefion Software         http://www.gefionsoftware.com
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to