Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

NEWBIE: from a servlet, how do i access a class reference?  RSS feed

 
david parham
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ex: inside "InitServlet" class[servlet], i've already received an ID and PW from a login screen:
//----------------------------------
// Retrieve parameters
//----------------------------------
String strID = request.getParameter("ID");
String strPW = request.getParameter("PW");
now i want to compare the strID and strPW with an array of ID's and PW's in a class named UserAccount. I'm trying this:
UserAccount newID = new UserAccount();
newID.setID(strID); //to pass the strID to the class.
in the UserAccount, i have a constructor and some setID, etc which should process a comparison between the passed ID and the stored ID, etc.
when i compile the servlet[InitServlet] it says of UserAccount, "cannot resolve symbol"
i feel my knowledge is negating the fundamentals. can you help with where i am going wrong/not going right??
thank you for any assistance!
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like 1 of a couple of things. You either have some classpath issue or you did not import that package containing your UserAccount class.
A bit more info from you would help.
1. Did you put UserAccount in the WEB-INF/classes folder?
2. Does UserAccount exist in a package (com.mystuff.UserAccount)
3. Did you import that package in your serlvet (import com.mystuff.UserAccount)
 
david parham
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my html works fine with my servlet.
html receives parms, servlet spits them out.
the UserAccount is in a package, it is imported appropriately:
//*********************//
// Imports //
//*********************//
import java.io.*;
import javax.servlet.*;
import csc258.week01.*;
//we're not allowed to use http.servlet assistance at this point
HOWEVER: note this: basic classes don't seem to be working at this point.
a shape.class + line.class + oval.class that worked together before, from the same directory, are not compiling[line and oval do, but the shape class say line and oval, "cannot resolve symbol"
looks like something even more fundamental that what i flagged you for in the first place your response sounds reasonable; sorry to be misleading.
any clues as to why a simple class[es] aren't recognized?
again, some classes compile, it just looks like the driver classes don't.
thanksgain.
 
david parham
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gregg - you were on the $$. after using this: java -classpath.MyDriver
my test run on MyDriver ran.
so yes it must be a classpath issue. what should i make sure is in the classpath environment var?
thx for your time!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!