The value for the useBean class attribute ... is invalid

62,269

Solution 1

You should put the file under WEBINF/classes/user

Solution 2

3 things

  1. Make sure the class file is under WEBINF/classes/user
  2. Make sure there is a public default constructor without arguments
  3. You can also use type= instead of class= if the bean already exists in the scope

Solution 3

Make sure that the default no-arg constructor is there and is public.

Share:
62,269

Related videos on Youtube

user62835
Author by

user62835

Updated on July 09, 2022

Comments

  • user62835
    user62835 almost 2 years

    I want to use a Java file SaveProp which is written in a package user. The class file has been placed in WEBINF/classes. Below are the two lines which cause the issue.

    jsp:useBean id="user" class="user.SaveProp" scope="session"
    
    jsp:setProperty name="user" property="*"
    

    It throws:

    The value for the useBean class attribute user.SaveProp is invalid
    

    I'm using Tomcat 6.0.

  • atom88
    atom88 over 9 years
    Thank you very much! This saved the day!
  • Joshua Stafford
    Joshua Stafford over 8 years
    which file goes in that folder? the .java, .class, .war?