Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / March 2005

Tip: Looking for answers? Try searching our database.

Tomcat + JSP + GUI trouble: javax.servlet.ServletException: UserData (wrong name: UserData/UserData)

Thread view: 
Chenium - 31 Mar 2005 00:47 GMT
My group is working on a vendor type based website for a software
engineering engineering course.  We have little to no experience in
java or jsp.  Most of the knowledge we know about the languages has
been absorbed from tutorials from the interenet in the past few weeks.
Now on to our troubles.  We're trying to design a log-in page were
users of our website can log in to utilize our service.  The tutorial
we're using comes from http://www.jsptut.com sections 9 and 10.

Heres snippets of our code:

************************************************************
this is from login.jsp:

<p align="center">Login:</p>
<form method="POST" action="auth.jsp">
       <p align="center">
       Username:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <INPUT TYPE=TEXT name="username" size="20"><br><br>
       Password:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input type=PASSWORD  name="upassword" size="20"><br><br>
       &nbsp; <input type=SUBMIT>
       </p>
</form>
************************************************************

this is from auth.jsp:

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

<HTML>
<HEAD><TITLE>BookWorms - Authenticating...</TITLE></HEAD>
<BODY>

<%
       Connection dbconn;
       PreparedStatement sql;
       try{
               Class.forName("org.gjt.mm.mysql.Driver");
               try{
                       String name;

                       boolean doneheading = false;

dbconn=DriverManager.getConnection("jdbc:mysql://localhost/group10","group10","password");

                       Statement statement = dbconn.createStatement();

                       String query = "SELECT * FROM members WHERE
username = 'lmachado'";
                       ResultSet rs;
                       rs = statement.executeQuery(query);

                       while(rs.next()){
                               String dpass =
rs.getString("upassword");
                               String upass = user.getUpassword();
                               out.println(upass);
                               out.println(dpass);

                               if(dpass.equals(upass))
                                       out.println("good
password<br>");
                               else
                                       out.println("bad
password<br>");
                       }
               }

               catch (SQLException s){
                       out.println("SQL Error<br>" + s.getMessage());
               }
       }

       catch (ClassNotFoundException err){
               out.println("Class loading error");
       }

}
************************************************************

here is our class:

package UserData;

public class UserData {

       String username;
       String upassword;

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

       public void setUpassword(String value){
               upassword = value;
       }

       public String getUsername(){
               return username;
       }

       public String getUpassword(){
               return upassword;
       }

}

**************************************************************

When we try to log in using our page, tomcat gives these errors:

org.apache.jasper.JasperException: UserData (wrong name:
UserData/UserData)
javax.servlet.ServletException: UserData (wrong name:
UserData/UserData)

We're clueless on where to begin how to debug this.  Again, we have no
experience with programming in jsp or java.  Thanks in advanced.
Arnaud Berger - 31 Mar 2005 07:18 GMT
Hi,

In the statement :

<jsp:useBean id="user" class="UserData" scope="session"/>

I think you should specify the exact package i.e : class="UserData.UserData"

Please note that it is not advised to have package name like the class name.

Furthermore, and by convention, the package name is usually written in
lower-case .

Regards,

Arnaud
> My group is working on a vendor type based website for a software
> engineering engineering course.  We have little to no experience in
[quoted text clipped - 39 lines]
>
>                         boolean doneheading = false;

dbconn=DriverManager.getConnection("jdbc:mysql://localhost/group10","group10
","password");

>                         Statement statement = dbconn.createStatement();
>
[quoted text clipped - 69 lines]
> We're clueless on where to begin how to debug this.  Again, we have no
> experience with programming in jsp or java.  Thanks in advanced.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.