This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Hi all, I have 2 java files one is a servlet and the other is an ordinary java file which checks to see whether a username and password exists in the database(UserPresent.java).This file has got the presentation layer which has to be put into the servlet. The servlet file must call the UserPresent.java file.I am going to make an interface to the UserPresent.java file ,I will call it User.java.This User.java file will have a method by name public boolean validateUser(String username,String pasword) . The UserPresent.java file will implement this interface.
My question now is,where will these java files be put ?,hope that my point is conveyed.How do I test UserPresent.java file.Kindly excuse me if there is a much more sophisticated way of expressing this. Hoping to hear from you all Thanks AS
Hi, to test the method write a simple Testclass that instantiates User in it's main and find out if you get true when callig the validation method with a user/pwd pair that clicks. If that works, place all of your classes in the WEB-INF/classes of your webapp. You should now be able to test the method in your servlet. If you pack everything together in a jar file, place this file in WEB-INF/lib instead. Good luck, J.
Joined: Nov 13, 2003
Thanks for the reply, I have a question regarding the testing of the program as you have said. I have made a java program UserPresent.java,that implements User.The code is given below.
This is the error I am getting at compile time.I am new to this kindly let me know. [BOLD] UserPresent.java:6: illegal start of type try ^ UserPresent.java:41: <identifier> expected ^ [/BOLD]