I am stuck at parts 3&4 any help x L 2017s CPS3740 Google Dr X Chegg Study l Gui
ID: 3792108 • Letter: I
Question
I am stuck at parts 3&4 any help
x L 2017s CPS3740 Google Dr X Chegg Study l Guided soluti h Welcome to Eduardo's proje YouTube On e- C Secure https:/ drive.google.com PDF 2017s CPS3740 project Open with Lumin PDF Project description: This is an individual project with 4 phases, and this is the first phase. You have to finish phase #1 in order to work on phase #2. You will design and implement an online Information system using MySQL HTML and (PHP or JAVA) You can refer to demo httplimckean eduCPS3240 Platform requirement: My Drive 1. You have to implement the projects on eve.kean.edu 2. You have to use MySQL to implement the database functions and store tables/data at imc.kean.edu. Your project CAN NOT be based the personal database running on your laptop or PC at home Phase #1 will require you to develop the following functions (total 100 points). 1. (10 pts) Create a CPS3740 project website on eve.kean.edu as shown in Figure 1. (4 pts) Permission mode 705 for your project folder and all PHP/HTML files. 1.1 (4 pts) Your project URL should be: htt eve kean edu PS3740 index.html 1.2 (2 pts) The main page should show your name and two links to project 1 and project 2. 1.3 2. (10 pts) When users click on Project 1 link, you should show the following features as shown in Figure 2. 2.1 (2 pts) Display welcome message with your name and Project 1 (2 pts) A link to list a users in the store. 2.2 (4 pts)Two textboxes for user to enter login ID and password, and a submit button. 2.3 2.4 (2 pts) You have to use POST method to implement the HTML FORM. Welcome to Austin Huangs CPS3740 project 1 C O imcke an edu/C Welcome to Austin CPS3740 Project Login ID: panda Password: Submit Figure 2. project 1 page Figure 1. main page 3. 10 pts) When users click on the link "list a users", a program should be called to list all users at CPS3740. Users table as shown in Figure 3 (3 pts) The output should be aligned for all columns using HTMLExplanation / Answer
The project design as below having all phase.
1.index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Welcome imc.kean.edu</title>
</head>
<body>
<h1>Welcome</h1>
<table>
<tr><a href="Project1.jsp" >1.Project1</a> </tr>
<tr><a href="Project2.jsp" >2.Project2</a> </tr>
</table>
</body>
</html>
2.Project1.jsp
<html>
<body background="back new1.jpg">
<h1>Please Login...</h1>
<div class="login">
<form name="login" method="post" action="login">
<a href="listuser.jsp">List all User</a><hr/><br>
<table align="center" cellspacing="10%">
<tr>
<th align="left">UserName</th>
<td><input type="text" value="" name="uname"></td>
</tr>
<tr>
<th align="left">Password</th>
<td><input type="password" value="" name="pwd"></td>
</tr>
<tr>
<th><input type="submit" value="Submit" > </th>
<th><a href="register.jsp">New User</a></th>
</tr>
</table>
</form>
</div>
</body>
</html>
3.Project2.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
Project2 write here what you want
</body>
</html>
4.register.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.io.*"%>
<%@page import="java.lang.*" %>
<%@page import="java.sql.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Registration Page</title>
</head>
<body >
<h1 align="center">Registration</h1>
<%-- <p>Goto <a href="index.jsp">HOME</a> page.</p>
<a href="index.jsp"><div class="header">JavaCompiler</div></a> --%>
<div class="register">
<form name="registration" method="post" action="register">
<table align="center" cellspacing="20px" border="0">
<tr>
<%-- <td colspan="2">UserName already taken. Please choose another.</td>--%>
</tr>
<tr>
<td colspan="2">Please Enter Your Details.</td>
</tr>
<tr>
<th>Enter UserName:</th>
<td><input type="text" value="" name="uname"></td>
</tr>
<tr>
<th>Enter Email Id:</th>
<td><input type="text" value="" name="email" ></td>
</tr>
<tr>
<th>Create Password:</th>
<td><input type="password" value="" name="pwd"></td>
</tr>
<tr>
<th>ReEnter Password:</th>
<td><input type="password" value="" name="repwd"></td>
</tr>
<tr>
<th>Security Question:</th>
<td>
<select name="question">
<option>Choose your security question.</option>
<option>What is the name of your best friend?</option>
<option>What is your first phone number?</option>
<option>What is your library card number?</option>
<option>What is the name of your favorite teacher?</option>
<option>What is your vehicle registration number?</option>
</select>
</td>
</tr>
<tr>
<th>Answer:</th>
<td><input type="text" value="" name="answer"></td>
</tr>
<tr>
<th colspan="2"><input type="checkbox" name="accept"> I accept to Terms and Conditions.</th>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Create My Account" name="submit"></td>
</tr>
</table>
</form>
</div>
</body>
</html>
5.listuser.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>list user</title>
</head>
<body>
List of User
</body>
</html>
6. DbUtility.java
package com.dbutility;
import java.sql.Connection;
import java.sql.DriverManager;
public class DbUtility {
public static Connection getConnection() {
Connection con = null;
try {
String url = "jdbc:mysql://localhost:3306/test";
Class.forName("com.mysql.jdbc.Driver");
// System.out.println(url);
con = DriverManager.getConnection(url, "root", "root");
System.out.println("connected");
} catch (Exception e) {
e.printStackTrace();
}
return con;
}
}
7.LoginServlet.java
package com.sevlet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.dbutility.DbUtility;
public class LoginServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
System.out.println("in service");
String x = null;
String y = null;
Connection con = null;
Statement st = null;
try {
con = DbUtility.getConnection();
st = con.createStatement();
String uname=req.getParameter("uname");
String pwd=req.getParameter("pwd");
//System.out.println("Connected to DataBase...");
String qry="select uname,pwd from register where uname='"+uname+"'";
ResultSet rs=st.executeQuery(qry);
if(rs.next())
{
x=rs.getString(1);
y=rs.getString(2);
}
if((uname!=null && uname.equals(x))&& (pwd!=null && pwd.equals(y)))
{
Cookie cookie1 = new Cookie ("uname",uname);
Cookie cookie2 = new Cookie ("pwd",pwd);
//cookie1.setMaxAge(365 * 24 * 60 * 60);
res.addCookie(cookie1);
res.addCookie(cookie2);
RequestDispatcher rd=req.getRequestDispatcher("compiler.jsp");
rd.forward(req, res);
}
else
{
RequestDispatcher rd=req.getRequestDispatcher("nouser.jsp");
rd.forward(req, res);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.