Write a to-do list MEAN app. Users can add a to-do item. Each item should have a
ID: 3822994 • Letter: W
Question
Write a to-do list MEAN app. Users can add a to-do item. Each item should have a title, text, due, and status property. These should be displayed in a table. Each entry should have a delete button that deletes the item from the database. Each item should have an edit button that updates the database. There should also be an update button that sends the updated item to the server. Each item has a button that marks the item completed. You will also need to indicate whether the item is completed by updating the item's status column, and in the database as well. The app needs to run on localhost. Submit your code here.Explanation / Answer
//First.jsp which displays todolist on web browser
//For running this code you will require Apache Tomcat
//Put this file tomacat/webapps/ROOT folder
//and start tomacat by running tomcat/bin/startup.sh script
//and type localhost:8080/first.jsp on browser
<!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>
</body>
<form method="post">
<table border="2">
<tr>
<td>TITLE</td>
<td>TEXT</td>
<td>DUE</td>
<td>STATUS</td>
</tr>
<%
try
{
Class.forName("com.mysql.jdbc.Driver");
String url="jdbc:mysql://localhost/sothers";
String username="root";
String password="sagar123";
String query="select * from todolist";
Connection conn=DriverManager.getConnection(url,username,password);
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery(query);
while(rs.next())
{
%>
<tr><td><%=rs.getString("title"); %></td></tr>
<tr><td><%=rs.getString("text"); %></td></tr>
<tr><td><%=rs.getString("due"); %></td></tr>
<tr><td><%=rs.getString("status"); %></td></tr>
<% String in=rs.getString("title");
%> <tr><td><form action="complete.jsp" method="post">
<input type="hidden" value=in name="title"></input>
<input type="submit" value="Mark status"></input>
</form></td></tr>
<%
}
%>
</table>
<%
rs.close();
stmt.close();
conn.close();
}
catch(Exception e)
{
e.printStackTrace();
}
%>
</form>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.