JavaBean 'value for the useBean class attribute classes.UserData is invalid' [duplicate]

放肆的年华 提交于 2019-12-01 11:16:26

You need to set the bean properties in your NextPage.jsp file.

Add the following line after your useBean statement like this.

<jsp:useBean id="user" class="UserData" scope="session"/>
<jsp:setProperty name="user" property="*" /> 

The problem is that your UserData.class file is in wrong directory, which means UserData.class should actually be in webapps/app1/WEB-INF/classes/classes/UserData.class.

After compiling the java file "UserData.java",you will get one class file="UserData.class".Make sure that the UserData.class is located in User under class. ie the location of the file UserData.java and UserData.class must be-

..\Tomcat6.0\webapps\ROOT\WEB-INF\classes\UserData.java and ..\Tomcat6.0\webapps\ROOT\WEB-INF\classes\UserData.class

If "classes" is not present in WEB-INF,you can create a new folder named "classes" to store these files.Restart the tomcat to view changes.

The problem appears to be your referencing classes as a package. It is not, it is the root directory of the classes in the war.

remove the package line from your class, and refer to your bean as class="UserData" and see what happens.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!