Create two servlets for assignment

Assignment Help Web Project
Reference no: EM132850277

All of your classes should exist in a webd4201.lastnamefirstinitial package (all lowercase).

Be sure that you ZIP up your webd4201.lastnamefirstinitial folder that is in the Tomcat/webapps folder, with a copy of your source code (i.e. your Eclipse src folder) placed inside of it. Any other compression schemes other than *.zip will be penalized. This *.zip file should be submitted into DC Connect on or before the due date.

NOTE: there are penalties if you submit a website that does not have any meaningful content and/or does not implement some sort of professional looking layout.

For this assignment you are going to create several java classes/files, we will be building upon the existing code from previous assignments. It is suggested you use the Bradshaw jsp/servlet example as a start point. You are required to make a new project folder in your webapps folder in the Tomcat folder that is your lastnamefirstinitial. It is suggested that you copy the "demo" folder in the webapps folder, and then paste it in the same location, then rename the "demo - Copy" folder to your lastnamefirstinitial.

BE SURE TO USE YOUR webd4201.lastnamefirstinitial (all lowercase) AS THE PACKAGE NAME FOR YOUR JAVA CLASSES (this will build a
webd4201.lastnamefirstinitial folder in your build structure, this should already be the case from previous assignments, if not you are to change it so that it is.)

Be sure that your generated html conforms to XHTML 1.0 Strict compliance; you must include the success image when compliance is met.

In order for the validator to work you must include the following two lines at the top of your header.jsp file:

Submit complete program source code that satisfies the following requirements:

1. You are to continue to use a PostgreSQL database that runs on port 5432 (default), named webd4201_db that is owned by a user named webd4201_admin that has a password of webd4201_password

NOTE: This should already be set up from previous assignments. If you do not set your database up with these values exactly for testing, your program will not run on your instructor's laptop for assessment (there will be penalties).

2. Your database should be preloaded with tables for Users, Students, Faculty

3. Modify your StudentDA.java file so that there is a method named as listed and will perform the following:
- authenticate() (using a long student number and a String password ) - this method should return a Student object (if the student exists in the database). This method should throw a NotFoundException if the student number and password combination passed are not found in the database. This method should be static (i.e. it can be called as Student.authenticate(100111111, "password")

4. Modify the Student.java class to have:
a. class (i.e. static) method named authenticate() (that takes a long argument and a Sting) that call the similarly name method created in the StudentDA.java class (described above).

NOTE: at this point you should be able to test your code by placing a
Student.login(100111111, "password");
call into a main() method in your Student project (place inside a try...catch block to handle NotFoundException situations)

5. Take the provided website template provided in DC Connect and create a header.jsp and footer.jsp files. All of your pages will implement these two files
a. The header.jsp should also:
i. have a dynamic page <title> element that displays a passed variable by the page including the header.jsp
ii. determine whether a Student object has been loaded on the session or not:

1. if not, the nav bar should have links to a Login and Register page (that href login.jsp and register.jsp pages respectively)
2. if so (i.e. there is a Student object on the session), the Login and Register links should instead be Logout and Update (that href a Logout servlet and update.jsp page respectively)
3. Should import your Student project package:
<%@ page import="webd4201.lastnamefirstinitial.*" %>

6. You are to also create an index.jsp page, a login.jsp page, a dashboard.jsp page, a register.jsp page and an update.jsp page (all of which implement your header.jsp and footer.jsp files)
a. You index.jsp page should contain a description of what the page/website is (i.e. a student mark tracking site for Durham College students)
b. Your login.jsp page should have a form with login and password text input boxes that submits to the LoginServlet (described below) in post mode
c. Your dashboard.jsp should be where the user that successfully log ins in your LoginServlet is redirected, and a personalized welcome message should be display (using the Student object that is placed on the session).
d. The register.jsp and update.jsp pages can simply implement the header (with a dynamic <title>) and footer files (no other content is required for this assignment)

7. You will create two servlets for the assignment:
a. a LoginServlet class (you can use the provided demo.LoginServlet example as a start point) file such that retrieves the two (2) strings from the login.jsp page (instead of one).
i. The file should then call the Student.authenticate() method that takes the login and password strings as arguments (the authenticate() method that returns a Student object). If the Student is not found (i.e. the servlet catches a NotFoundException) the message should be shown on the login page state that the login and password combination was not found in the database. An acceptable error message would be "Your login information is incorrect. Please try again." If the student is found, the returned Student object should be loaded onto the session, and the servlet should then redirect the user to the dashboard.jsp page (described above). This page should give a personalized welcome based on the Student object's attributes on the session.

b. a LogoutServlet that when it is accessed, simply removes the student object from the session that was loaded when a Student successfully logged on (to do this use the session.removeAttribute() method in the servlet class passing the named used to set the attribute in the login servlet).
This servlet should add a message "You have successfully logged out" onto the session, and the user should be redirected to login.jsp (where the message is displayed)

8. You are to modify the web.xml file in your lastnamefirstinitial/WEB- INF folder as follows:
a. The display name should be changed to reflect your name and the course code from:
<display-name>WEBD4201 JSP/Servlet Website</display-name>
<description>
Website for deliverables in Web Development Course
</description>

b. LoginServlet class should be mapped to your package (not the demo package):
<servlet>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>demo.LoginServlet</servlet-class>
</servlet>

c. Create new <servlet> and <servlet-mapping> elements to link your href="./Logout" to your new LogoutServlet class

<servlet>
<servlet-name>LogoutServlet</servlet-name>
<servlet-class>lastnamefirstinitial.LogoutServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LogoutServlet</servlet-name>
<url-pattern>/Logout</url-pattern>
</servlet-mapping>

Attachment:- Build your Java code.rar

Reference no: EM132850277

Questions Cloud

How much is the cost of goods sold : The following information is available for Wagner Corporation for the current year: Sales $500,000. How much is the cost of goods sold
Examine self-efficacy : Do you believe you can do a good job in the field(s) you have chosen? If not, can you change your beliefs or are you destined to be run by them?
What is custodial interrogation : What did the U.S. Supreme Court decide regarding the drug testing of students? What is a custodial interrogation? When does it occur?
How large would her payments be : Suppose Ivan borrowed RM50,000 at a rate of 8% and must repay it in 4 equal installments at the end of each of the next 4 years. How large would her payments be
Create two servlets for assignment : Create two servlets for assignment - create an index.jsp page, a login.jsp page, a dashboard.jsp page, a register.jsp page and an update.jsp page
Assess emotional intelligence and personal issues : Assess emotional intelligence and personal issues. Assess how your ability to manage your emotions might impact your job performance
Current policy in the middle east : Discuss a specific current policy from one Middle Eastern country. What are the impacts of the policy within the respective country, the Middle East
Criminological terms : Using criminological terms and concepts discuss a jurisdiction, neighborhood, or geographic locale with which you are familiar.
Identify about behavior that perceive to be important : Identify something about your behavior (being a good listener) that you perceive to be important to your personal or professional life.

Reviews

Write a Review

Web Project Questions & Answers

  Build and test a small web application

Build and test a small web application using both client and server side technologies and a web server scripting language

  Deployment based on design and deployment plan

Objectives - develop and deploy the solution/smart application you proposed in your assignment two and submit a short report to show develop and deploy process and difficulties you encountered.

  Create a taekwondo grading app for city west

NIT6120 Mobile Applications - victoria university - create a Taekwondo grading app for City West Taekwondo(CWT) Trading Centre

  Develop an online booking system for Restaurant

ISCG6420 Internet and Website Development Project Assignment - Create an Interactive Application, Unitec Institute of Technology, New Zealand

  Create a page and datalayer code for retrieve contract info

Create a page, code and datalayer code for Retrieve Contract Info for this project. List the major software components required.

  Explain the basic mechanism of web page formatting

OTM 425- HND Office Technology and Management-Advanced Webpage Design -Explain the basic mechanism of web page formatting.

  Design high-level logical system characteristics

Design high-level logical system characteristics

  Database driven web application

The project is to design, create, evaluate and present/defend a database driven PHP web site, to demonstrate what you have learnt from the module topics.

  Rescue tutoring service needs a more stylish web page

Rescue Tutoring Service needs a more stylish Web page than the extremely plain one they have sent to you. Follow the instructions below to create a cascading style sheet that will spruce up their web presence.

  What databases the hosting company supports before choosing

For example, if you eventually want to add database connectivity to your site, you need to know what databases the hosting company supports before choosing.

  Prepare a static web page that includes the basic structure

Prepare a static Web page that includes the basic structure of a valid HTML (not XHTML) document. The language attribute of the html element.

  Human factors to consider when building a web site

What are some human factors to consider when building a Web site and what are some technical factors to consider when building a Web site?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd