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

  Evaluating an ecommerce website

Create a check list that contains key point for evaluating an ecommerce website - Write a short, reflective report about website

  Gpc and runtime magic quotes

Create a script that lets you know whether Zeus or Helios has the GPC and Runtime Magic Quotes turned on or off. The output should have appropriate labels that define what output signified and should display 'ON' or 'OFF' depending on the setting.

  Creating functions through conditional operator

Use the conditional operator and the cal_days_in_month function, determine the number of days in the current month and output to browser whether it is normal month or a leap month.

  Web development projects with database

Since the vast majority of web-development projects involve a database, do you think that computational activities should be performed there, or do you think they belong in the XML page or stylesheet?

  Comparing shelf software packages

Required assistance with comparing and contrasting two main off the shelf software packages that could be implemented in an organization.

  Web based scams

Web phishing, pharming and vishing are popular web based scams. Talk about currently used tools and recommended measures to defeat this kind of attacks efficiently?

  Explanation of contextual links

The most powerful hypertext capabilities is the the contextual link. Wikipedia . com is a great example of a site that utilizes contextual links.

  How architectural and protocol changes occur

Discuss how architectural and protocol changes happen, the administrative organization that oversees the technical development of the Internet,

  Traditional approaches for training professionals

Webinars and other web conferencing techniques have proved most beneficial for the provision of affordable quality corporate training.

  Internet for business

Discuss how can a business use the Internet and give at least three examples with web links demonstrating your answer.

  It influences the behavior of organizations

Information technology influences the behavior of organizations. Name one effect of Information technology implementation and long-term usage you suppose having a positive contribution and one having a negative consequence.

  Importance of a guided navigation system

Explain the use and importance of a guided navigation system and shopping cart for a website designed for e-commerce and business purpose.

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