Results 1 to 2 of 2
  1. #1
    jainpankaj15m is offline Member
    Join Date
    Jul 2007
    Posts
    1
    Rep Power
    0

    Exclamation javaBeans with JSP

    Hello everyone..
    i have one problem..
    i want to use javaBeans with JSP in JBuilder(Eclipse) IDE.
    i hv one JSP named :
    'BeanJsp.jsp' with code :

    <jsp:useBean id="the" class="CalcBean"/>
    <HTML>
    <HEAD>
    </HEAD>
    <BODY>
    <&#37;
    int i = 4;
    int j = the.doubleIt(i);
    out.print("2*4=" + j);
    %>
    </BODY>
    </HTML>

    and one JavaBean named:
    'CalcBean.java' with code :

    public class CalcBean {
    CalcBean(){ }
    public int doubleIt(int number) {
    return 2 * number;
    }
    }

    while running on Tomcat 5.5 server it is giving error:
    "org.apache.jasper.JasperException: /BeanJsp.jsp(2,0) The value for the useBean class attribute CalcBean is invalid."

    this problem is only with JBuilder IDE..on Gel IDE it is working..
    pls solve my problem n do reply soon...
    Thanx.
    :: pankaj
    Last edited by jainpankaj15m; 07-25-2007 at 01:01 PM.

  2. #2
    shanePreater is offline Member
    Join Date
    Jul 2007
    Location
    England, Bath
    Posts
    47
    Rep Power
    0

    Default

    This looks like it is due to the fact that tomcat can not find the CalcBean class. Where are you saving CalcBean.java?

    If it is not in the default package (I.E. no package declaration at the top of CalcBean.java) then you would need to add an import to the jsp page or fully qualify the CalcBean reference (If the CalcBean file was under com/onevisionsupport/example then the useBean would need to be com.onevisionsupport.example.CalcBean).

    If this doesn't help let me know also if you could provide details of the structure you are using and I will see if I can work it out for you.

Similar Threads

  1. Exception in JavaBeans
    By bbq in forum Enterprise JavaBeans (EJB)
    Replies: 2
    Last Post: 07-04-2007, 08:33 AM
  2. javabeans?
    By sin in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 05-15-2007, 06:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •