Unfortunately, your syntax is a bit off. Try this:
<html>
<head>
<title>Results</title>
<%@ page import="travel_agent.*" %>
</head>
<body>
<% Accomodation ac= new Accomodation(); %>
<% ac.HotelName = "one"; %>
<input type="text" name="T2" size="20" value="<%= ac.HotelName %>">
</body>
</html>
(*Chris*)
----- Original Message -----
From: "panos periorellis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 15, 2002 3:59 PM
Subject: Re: [JSP-INTEREST] Importing my Own class
> I read your message about importing classes and copied all my classes in
th
> WEB-INF directory..
>
> MY JSP compiles now and i can make instances of my classes...
>
> However when i try to reference attributes in those classes it produces an
> error
>
> why do you think that may be? this is my code
>
> <html>
>
> <head>
>
> <title>Results</title>
> </head>
>
>
> <body>
>
>
> <%@ page import="travel_agent.*;" %> // this is a directory with classes
> which exists in WEB-INF so I guess this line is fine
>
> <% Accomodation ac= new Accomodation; %> // this is a class in the
> travel_agent directory
>
> <%! ac.HotelName="one"; %> // this line produces an error it says that
is
> cannot be referenced.
>
> <input type="text" name="T2" size="20" value=<%= ac.HotelName %> >
>
> </body>
> </html>
>
> ----- Original Message -----
> From: Zvika Markfeld <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, January 15, 2002 20:16
> Subject: Re: Importing my Own class
>
>
> > 1. place the class file insode your WEB-INF/clasess directory, not
> > public_html
> > 2. import statements refer to a fully qualified class name, not a file
> name
> > with path and everything.
> > 3. there should be a compliance between a package name and directory
> > structure.
> > For example, if your class is a part of a package called mypackage, then
> it
> > should reside inside directory WEB-INF/clases/mypackage, and you should
> use
> > import="mypackage.ScrapBook".
> > Besides, Weblogic 5.1 does not allow using JavaBeans from within a JSP
> that
> > belong to the default package. This might be a bug or a spec dictation
> > (stranger things have been recorded), so you may consider using a
package
> > for your class.
> > zm.
> >
> >
> > -----Original Message-----
> > From: A mailing list about Java Server Pages specification and reference
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Gardner Monte
> > Sent: Tuesday, January 15, 2002 9:59 PM
> > To: [EMAIL PROTECTED]
> > Subject: Importing my Own class
> >
> >
> > I rent space on a commercial Tomcat JSP-Enabled server.
> > I have a JSP page in the directory
> > /usr50/home/mgardne/public_html/jsp/pictures.jsp
> >
> > I have a Class file in the directory
> >
> > /usr50/home/mgardne/public_html/servlets/ScrapBook.class
> >
> > The ScrapBook class is not part of any package.
> >
> > I would like to import the ScrapBook class into my JSP code
> > so that I can instantiate objects of that type. In the
> > Archives someone stated that you could import a class file
> > by using the actual path like this
> > <%@ page import="/usr50/home/mgardne/public_html/servlets/ScrapBook" %>
> >
> > but when I tried to run that code I got an error.
> >
> > My web host provider generally doesn't let me change class path
settings,
> > or put my own classes in the class path, so I was wondering if there
> > was a direct way of telling the JSP engine where my class file is
located.
> >
> > --Monte Glenn Gardner
> >
> >
>
===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://archives.java.sun.com/jsp-interest.html
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.jsp
> > http://www.jguru.com/faq/index.jsp
> > http://www.jspinsider.com
> >
> >
>
===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://archives.java.sun.com/jsp-interest.html
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.jsp
> > http://www.jguru.com/faq/index.jsp
> > http://www.jspinsider.com
> >
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://archives.java.sun.com/jsp-interest.html
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.jsp
> http://www.jguru.com/faq/index.jsp
> http://www.jspinsider.com
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com