You need to use the jsp:useBean tag as well as use the correct directive for
importing.The syntax for both is given below:
<%@ page import = "HiBean" %>
<jsp:useBean id = "hello" class = "HiBean" scope = "request" />
Have a nice day.
With regards,
Sachin S. Khanna.
www.emailanorder.com
----- Original Message -----
From: Portal Team <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 11, 2000 2:35 PM
Subject: my first bean in JSP .. pls help
> hi
>
> I am trying to use my first bean in a JSP ; example from Java Servlet
> Programming by Jason Hunter
>
> My bean class is
> public class HiBean {
> private String name="world";
> public void setname(String name)
> { this.name=name;}
> public String getName()
> { return name; }
> }
>
> my JSP file is
> <%@ import= "HiBean" %>
> <bean name="hello" class="HiBean" scope="request"> </bean>
> <html> <body>
> <h1> Hello <%=hello.getName()%> </h1>
> </body> </html>
>
> I have saved the HiBean class file in javawebserver2.0\classes
> and the jsp in public_html
> I get only "Hello" the getName is not displayed
>
> If i shift the class file to public_html,
> I am getting the error
>
> Error during page parsing:
> com.sun.server.http.pagecompile.jsp.compiler.ParseException:
> C:\javawebserver2.0\public_html\testbean.jsp(0,4)
>
> Invalid directive
>
> is the bean tag used and understood or should i go for jsp:usebean , what
is
> the difference
>
> I am using JavaWebServer2.0
> thanks in advance
> Vineet
> PS. I would appreciate a link to a comple tutorial on using beans
>
>
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.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
>
===========================================================================
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