hi
where have u placed your class file

if tomcat
then your classfile should be in
\webapps\hellopackage\Web-inf\classes\hellopackage
Regards
> -----Original Message-----
> From: nadia [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, September 14, 2001 1:03 PM
> To:   [EMAIL PROTECTED]
> Subject:      how to access java classes from jsp
>
> Hi there all.
> I have just started learning jsp and am not sure how to access a class
> file from within a jsp page.
> I have heard that it should be a Bean and u access it by doing the
> following.
> <jsp:useBean id="mybean" scope="page"
> class="hellopackage.Hello" />
> <jsp:setProperty name="mybean" property=" * "  />
>
> My problem is that I have created the following bean..
> package hellopackage;
>
> public class Hello{
> private String username;
>
> public Hello(){
>     username=null;
> }
> public void setUserName(String name){
> username=name;
> }
> public String getUsername(){
>  return username;
> }
> }
> and I am trying to access it with the folowing page..
> <%@ page import="hellopackage.Hello"%>
>
> <jsp:useBean id="mybean" scope="page"
> class="hellopackage.Hello" />
> <jsp:setProperty name="mybean" property=" * "  />
>
> <html>
> <head><title>Hello,User</title></head>
>
> <body bgcolor="#ffffff" background>
> <h1>What is your name ?</h1>
> <form method="get">
> <input type="text" name="username" size="25">
> <br>
> <input type="submit" value="Submit">
> <input type="reset" value="Reset">
> </form>
>
> <% if(request.getParamater("username") != null){
> %>
> <%@ include file="response.jsp" %>
> <%
>  }
> %>
> </body>
> </html>
>
> I keep getting the following error
> jsp:useBean can't find class `hellopackage.Hello'
>
>
> I am realy stuck cause how do u let the jsp see the bean..
> I have even tried putting the bean in a jar file called hellopackage...
> Pls help....
> Thanking you all in adavance

===========================================================================
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://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