Java – The value for the useBean class attribute … is invalid

javajsppropertiestomcat

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.

Best Solution

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
Related Question