Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

javaBean class invalid error

843836Mar 30 2005 — edited Mar 30 2005
Hello there,

I am new to jsp development and am having problems using javabeans. I get a class invalid error. I have created a simple example that works fine without the useBean line (there Bean doesn't do anything in the example). I have looked over earlier posts in which others have discussed this same problem (http://onesearch.sun.com/search/clickthru?qt=useBean+invalid&url=http%3A%2F%2Fforum.java.sun.com%2Fthread.jspa%3FforumID%3D45%26threadID%3D567258&pathInfo=%2Fonesearch%2Findex.jsp&hitNum=1&col=developer-forums), but I none of the proposed fixes has worked for me. I hope that someone will see something that I'm missing. Below are the files that make up the example
// userInput.jsp
  <html>
    <body>
      <h3>UserInput Form</h3>
      <form name="inputForm" action="userOutput02.jsp" method="post">
        <input type="text" name="userName">
        <input type="submit" name="submit" value="GO">
      </form>
    </body>
  </html>

// userOutput02.jsp
  <jsp:useBean id="userInfo" scope="session" class="beans.User" />
  <html>
    <body>
      <h3>User Output</h3>
      Hello <%=request.getParameter("userName")%><br>
      <a href="userInput.jsp">Enter another name</a>
    </body>
  </html>

// User.java
  package beans;
  public class User {
    protected String name;
    public User () {}
    public String getName () {
      return name;
    }
    public void setName (String userName) {
      name = userName;
    }
  }
// Location of User.class
<%webApplicationRoot%>/WEB-INF/classes/beans

// Error Message when userOutput02.jsp is loaded
org.apache.jasper.JasperException: /jsp/userOutput02.jsp(1,1) The value for the useBean class attribute beans.User is invalid.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 27 2005
Added on Mar 30 2005
5 comments
233 views