aspose file tools*
The moose likes JSP and the fly likes The value for the useBean class attribute user.UserData is invalid. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "The value for the useBean class attribute user.UserData is invalid." Watch "The value for the useBean class attribute user.UserData is invalid." New topic
Author

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

naveen gandham
Greenhorn

Joined: Oct 15, 2008
Posts: 8
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

Joined: Jan 28, 2003
Posts: 4181
    
  21

Your user.UserData.class file is in:
<Application_Base>/<application_name>/WEB-INF/classes/user/
directory? It is spelled properly?


Steve
naveen gandham
Greenhorn

Joined: Oct 15, 2008
Posts: 8
Hmm I have forgot to place the compile .class file under classes directory .now it working fine..........
Dikshant Agarwal
Greenhorn

Joined: Oct 21, 2013
Posts: 8
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

Joined: Jan 28, 2003
Posts: 4181
    
  21

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

Joined: Oct 21, 2013
Posts: 8
thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The value for the useBean class attribute user.UserData is invalid.