Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: What do I need to do to use a bean in Netbeans 7 apart from defining it?

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    26
    My Mood
    Fine
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Question What do I need to do to use a bean in Netbeans 7 apart from defining it?

    Hi!

    I'm learning to use beans in JSP and from what I've gathered all I'm required to do is to create a class with appropriate constructor and getter-setter functions and specify it's name as value of the attribute "class" in the jsp:useBean action tag. But this is not working. I'm getting "cannot find symbol" errors while compiling.

    /media/d/Portal/JAVA/WebKand/build/generated/src/org/apache/jsp/trial_jsp.java:124: cannot find symbol
    symbol  : class trialbean
    location: class org.apache.jsp.trial_jsp
            trialbean bn = null;
    /media/d/Portal/JAVA/WebKand/build/generated/src/org/apache/jsp/trial_jsp.java:126: cannot find symbol
    symbol  : class trialbean
    location: class org.apache.jsp.trial_jsp
              bn = (trialbean) _jspx_page_context.getAttribute("bn", PageContext.REQUEST_SCOPE);
    /media/d/Portal/JAVA/WebKand/build/generated/src/org/apache/jsp/trial_jsp.java:129: cannot find symbol
    symbol  : class trialbean
    location: class org.apache.jsp.trial_jsp
                  bn = (trialbean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "trialbean");
    The .class file is in WEB-INF/classes.
    Am I supposed to do something to enable the beans?


  2. #2
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    472
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: What do I need to do to use a bean in Netbeans 7 apart from defining it?

    You haven't posted your bean code, so does your bean follow the Javabeans Specification? I'd also recommend following the Java Naming Conventions - class names start with uppercase letters, and I'd put it in a package - I've had problems before with classes not being found when not in a package.

    You might find the NetBeans JavaBeans Tutorial useful.
    Last edited by dlorde; July 30th, 2011 at 02:37 PM.

  3. The Following User Says Thank You to dlorde For This Useful Post:

    Lord Voldemort (July 31st, 2011)

  4. #3
    Junior Member
    Join Date
    Jun 2011
    Posts
    26
    My Mood
    Fine
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default Re: What do I need to do to use a bean in Netbeans 7 apart from defining it?

    Thanks a lot dlorde. Putting the bean in a package made it work. It's not necessary for class names to start with uppercase letters though.

Similar Threads

  1. Netbeans 6.8
    By selmaky in forum Java IDEs
    Replies: 1
    Last Post: May 14th, 2011, 03:08 PM
  2. New to NetBeans
    By _lithium_ in forum Java IDEs
    Replies: 0
    Last Post: March 1st, 2011, 08:48 PM
  3. converting HashMap to a Bean
    By achsu in forum Collections and Generics
    Replies: 0
    Last Post: February 2nd, 2011, 09:13 PM
  4. Servlet Writing to Object or Bean
    By kurt-hardy in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: January 12th, 2011, 11:27 AM
  5. Netbeans help
    By [Kyle] in forum Java IDEs
    Replies: 2
    Last Post: September 20th, 2009, 06:32 PM

Tags for this Thread