Part I – Build a simple Servlet called MyServlet using NetBeans. Add this Servlet to you “ChattBank”...

50.1K

Verified Solution

Question

Programming

Part I – Build asimple Servlet called MyServlet using NetBeans. Addthis Servlet to you “ChattBank” Project. This MyServletwill display a message like “Go Braves” in a simple

tag.Run this servlet from a Browser window by typing in the servletname in the URL line.

(ie. http://localhost:8080/ChattBank/MyServlet). Make sure thatyour Server is up and running before you test this Servlet. Thebest way to do this is just Run your “ChattBank” Project oncebefore you test the Servlet. Running the Project will start theServer.

Part II – Next, build a simple Servletcalled LoginServlet in your “ChattBank” Project. Nowmake it so that when the Customer logs in, the LoginServlet willget called and will validate the user id and password.

  1. At first, just make sure that the Servlet gets calledcorrectly. So just print a simple message like “LoginServletRunning…”.
  2. Remember, to call the LoginServlet, you will need to modify theFORM tag in the “Login.html” file:

  1. Test it out. When you click the Login Button on theLoginForm, you should see “LoginServlet Running….”

Part III – Now, modify theLoginServlet.

  1. Make it so that when the Servlet gets called, it reads the idand password from the Login Form.

Use :   request.getParameter() to get these items. At first just read inthese 2 strings and display them to the Server Log.

2.) If the id = “admin” and thePassword = “123”, return an HTML page     thatsays “Valid Login”.

3.) If not return an HTML page thatsays “InValid Login”. Use out.println() to send these HTMLmessages.

     4.) Test out yourWebApp.            

Part IV– Lastly, modify theLoginServlet. This time we are going to go to thedatabase to verify the user login. First look at the ChattBankdatabase. There is a Customers table. In this table there is aUserID and a Passwd. Write the database code, in your LoginServletto let anyone of these customers login, using their own ids andpasswords.    

Answer & Explanation Solved by verified expert
4.4 Ratings (900 Votes)
As per the given details the program should be as follows 1 indexhtml Chatt Bank Welcome to Chatt Bank 2 Loginhtml Chatt Bank Login Id Password 3 welcomehtml Chatt Bank Welcome to Chatt Bank 4 webxml MyServlet MyServlet LoginServlet LoginServlet MyServlet MyServlet LoginServlet LoginServlet 30    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students