Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
naveen gandham
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to get the data by using bean where I am facing the problem while running it ...

<html>
<body>
<form method=post action = "UserSave.jsp">
Name<input type =text name=username size =20><br>
Email<input type=text name=email size=20><br>
Age <input type=text name=age size=4><br>
<input type=submit>
</form>
</body>
</html>
---------------------------
UserData---java

package user;
public class UserData {
String username;
String email;
int age;

public void setUsername( String value )
{
username = value;
}

public void setEmail( String value )
{
email = value;
}

public void setAge( int value )
{
age = value;
}

public String getUsername() { return username; }

public String getEmail() { return email; }

public int getAge() { return age; }
}
-------------------
<jsp:useBean id="user" class ="user.UserData" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<html>
<body>
<a href="NewPage.jsp">continue </a>
</body>
</html>-------------UserSave.jsp
---------------------
<jsp:useBean id="user" class="user.UserData" scope="session"/>
<html>
<body>
You Entered <br>
Name:<%= user.getUsername() %><br>
E-mail:<%= user.getEmail() %><br>
Age : <%= user.getAge() %><br>
</body>
</html>------------NewPage.jsp
-------------------------------------------



org.apache.jasper.JasperException: /jsp/UserSave.jsp(1,1) The value for the useBean class attribute user.UserData is invalid.



org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


else this the url from where i am trying as an example
http://www.jsptut.com/Forms.jsp
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your user.UserData.class file is in:
<Application_Base>/<application_name>/WEB-INF/classes/user/
directory? It is spelled properly?
 
naveen gandham
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm I have forgot to place the compile .class file under classes directory .now it working fine..........
 
Dikshant Agarwal
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone,
I am also getting the same problem.Is put the bean class under webcontent/web-inf/
it is giving error likee this:-
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /createRect.jsp (line: 1, column: 1) The value for the useBean class attribute mypack.Rectangle is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:408)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:149)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1234)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1182)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2434)
org.apache.jasper.compiler.Node$Root.accept(Node.java:475)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
org.apache.jasper.compiler.Generator.generate(Generator.java:3490)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:250)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:668)


 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve Luke wrote:Your user.UserData.class file is in:
<Application_Base>/<application_name>/WEB-INF/classes/user/
directory? It is spelled properly?


substitute mypack for user in the quoted text, and Rectangle for UserData. So the question becomes:
Your mypack.Rectangle.class file is in:
<Application_Base>/<application_name>/WEB-INF/classes/mypack/
directory? It is spelled properly?
 
Dikshant Agarwal
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic