944,084 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Unsolved
  • Views: 642
  • JSP RSS
Oct 31st, 2009
0

javaBean

Expand Post »
Hi,
I am new to jsp, and Beans. I have been working on this piece of code, for the past week and I am no further along

I am using Tomcat Apache 6.0
In the ROOT folder I have a simple page test1.jsp:

JSP Syntax (Toggle Plain Text)
  1. package user;
  2. <%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
  3. <jsp:useBean id="userDetails" class="user.UserDetails" scope="session" />
  4. <jsp:setProperty name = "hopeThisWorks" property="*"/>
  5. <% userDetails.getData(); %>
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7. <html xmlns="http://www.w3.org/1999/xhtml">
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  10. <title>hello</title>
  11. </head>
  12.  
  13. <body>
  14. test 1
  15. </body>
  16. </html>

I have a java class in: WEB-INF\classes\user called UserDetails

Which I have attached.

I keep getting the error:

javax.servlet.ServletException: java.lang.NoClassDefFoundError: user/UserDetails (wrong name: java/user/UserDetails)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:275)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

As I said I have been working on it, and gotten no where, someone please help!!!

Thanks, Andrew
Attached Files
File Type: java UserDetails.java (2.1 KB, 9 views)
Last edited by peter_budo; Oct 31st, 2009 at 8:21 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Andrew Docherty is offline Offline
1 posts
since Oct 2009
Oct 31st, 2009
-1
Re: javaBean
You have package declaration on the top of JSP which is not need it, but you are missing package declaration in your UserDetails where obviously is need it...
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 874
Code tags enforcer
peter_budo is offline Offline
6,659 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: how can i run jsp
Next Thread in JSP Forum Timeline: How to insert data into database?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC