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 / JavaBeans / 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:45 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 and what these
errors even mean.  Again, we have no experience with programming in jsp
or java.  Thanks in advanced.
littlewild@gmail.com - 31 Mar 2005 03:47 GMT
The jsp:useBean tag requires a fully qualified class name. Meaning you
have to include the package name of the class too. In your case it will
be UserData.UserData

If you want to change the property of the bean, you need to place the
setProperty tag within the body of the useBean tag. Note that useBean
will only change the value of the bean only if it instantiates it.

For more info, see
http://java.sun.com/products/jsp/tags/11/syntaxref11.fm14.html


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.