Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions NewFile1.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,23 @@ footer
<a href="Controller?page=contact">Contact</a>
<a href="Controller?page=admin">Admin</a>

<form action="/OOAD/Controller" method="post">
<form action="Controller" method="post">
<input type="hidden" name="page" value="select">
<select name="option">
<option value="Articles">Articles</option>
</select>
<button>go</button>
</form>

<form action="/OOAD/Controller" method="post">
<form action="Controller" method="post">
<input type="hidden" name="page" value="search">
<input type="text" name="search2" required>
<button>search</button>
</form>
</nav>
</header>

<sql:setDataSource user="root" password="Fathihachellam.1" url="jdbc:mysql://localhost:3306/ooad?autoReconnect=true&&useSSL=false" driver="com.mysql.jdbc.Driver" var="db"/>
<sql:setDataSource user="root" password="123456" url="jdbc:mysql://localhost:3306/ooad?autoReconnect=true&&useSSL=false" driver="com.mysql.jdbc.Driver" var="db"/>

<sql:query var="physical" dataSource="${ db}">
select * from article where subject="Physical Science";
Expand Down Expand Up @@ -186,6 +186,7 @@ select * from article where subject="Mathematics";
<a class="subitem" href="Controller?page=view-article&title=${ row.title}"><c:out value="${ row.title}"></c:out></a><br>
</c:forEach>

<a class="list-group-item" href="Recommand.jsp">Recommand</a>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@salty-chen Please Replace Recommand with Recommend. -Hui

</div>
</div>
</div>
Expand Down
173 changes: 173 additions & 0 deletions Recommand.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@salty-chen Could you rename the file Recommand.jsp to Recommend.jsp? -Hui

pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Articles</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">

body
{
margin:0px;
}

header
{
background-color:black;
text-align:center;
height:70px;
margin-bottom:50px;
}

header nav
{
padding-top:20px;
}

header a
{
font-size:25px;
margin-left:25px;
text-decoration:none;
color:white;
cursor:
}

header a:hover
{
color:gold;
text-decoration:none;
}

header form
{
display:inline-block;
}

header select
{
margin-left:25px;
font-size:25px;
border-radius:3px 3px 3px 3px;
}

header button
{
font-size:20px;
border-radius:5px 5px 5px 5px;
}

header input
{
margin-left:25px;
font-size:20px;
border-radius:3px 3px 3px 3px;
}

div
{
width:80%;
margin:50px auto;
}

.table2
{
width:100%;
}

.table2 th
{
border:1px solid gray;
border-right:none;
border-left:none;
text-align:center;
font-size:20px;
margin-bottom:20px;
}

.table2 td
{
text-align:center;
font-size:20px;
}

.table2 a
{
text-decoration:none;
}

footer
{
background:black;
height:40px;
color:white;
text-align:center;
padding:5px;
font-size:20px;
margin-top:50px;
}

</style>
</head>
<body>

<header>
<nav>
<a href="Controller?page=home">Home</a>
<a href="Controller?page=aboutus">About us</a>
<a href="Controller?page=contact">Contact</a>
<a href="Controller?page=admin">Admin</a>

<form action="Controller" method="post">
<input type="hidden" name="page" value="select">
<select name="option">
<option value="Articles">Articles</option>
</select>
<button>go</button>
</form>

<form action="Controller" method="post">
<input type="hidden" name="page" value="search">
<input type="text" name="search2" required>
<button>search</button>
</form>
</nav>
</header>

<sql:setDataSource user="root" password="123456" url="jdbc:mysql://localhost:3306/ooad?autoReconnect=true&&useSSL=false" driver="com.mysql.jdbc.Driver" var="db"/>

<sql:query var="result" dataSource="${ db}">
select * from article order by popularity DESC
</sql:query>

<div>
<table class="table2">
<tr>
<th>Title</th>
<th>Author</th>
<th>Time</th>
<th>Popularity</th>
</tr>
<c:forEach items="${result.rows}" var="row">
<tr>
<td><a href="Controller?page=view-article&title=${ row.title}"> <c:out value="${ row.title}"></c:out> </a></td>
<td><c:set var = "string" value = "${ fn:length(row.author)}"/><c:out value="${ fn:substring(row.author, 0, 3)}***${ fn:substring(row.author, string-8, string)}"></c:out></td>
<td><c:out value="${ row.time}"></c:out></td>
<td><c:out value="${ row.popularity}"></c:out></td>
</tr>
</c:forEach>
</table>
</div>

<footer>
2019 copyright&copy;mjh.mohamed
</footer>

</body>
</html>
173 changes: 173 additions & 0 deletions Recommend.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Articles</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">

body
{
margin:0px;
}

header
{
background-color:black;
text-align:center;
height:70px;
margin-bottom:50px;
}

header nav
{
padding-top:20px;
}

header a
{
font-size:25px;
margin-left:25px;
text-decoration:none;
color:white;
cursor:
}

header a:hover
{
color:gold;
text-decoration:none;
}

header form
{
display:inline-block;
}

header select
{
margin-left:25px;
font-size:25px;
border-radius:3px 3px 3px 3px;
}

header button
{
font-size:20px;
border-radius:5px 5px 5px 5px;
}

header input
{
margin-left:25px;
font-size:20px;
border-radius:3px 3px 3px 3px;
}

div
{
width:80%;
margin:50px auto;
}

.table2
{
width:100%;
}

.table2 th
{
border:1px solid gray;
border-right:none;
border-left:none;
text-align:center;
font-size:20px;
margin-bottom:20px;
}

.table2 td
{
text-align:center;
font-size:20px;
}

.table2 a
{
text-decoration:none;
}

footer
{
background:black;
height:40px;
color:white;
text-align:center;
padding:5px;
font-size:20px;
margin-top:50px;
}

</style>
</head>
<body>

<header>
<nav>
<a href="Controller?page=home">Home</a>
<a href="Controller?page=aboutus">About us</a>
<a href="Controller?page=contact">Contact</a>
<a href="Controller?page=admin">Admin</a>

<form action="Controller" method="post">
<input type="hidden" name="page" value="select">
<select name="option">
<option value="Articles">Articles</option>
</select>
<button>go</button>
</form>

<form action="Controller" method="post">
<input type="hidden" name="page" value="search">
<input type="text" name="search2" required>
<button>search</button>
</form>
</nav>
</header>

<sql:setDataSource user="root" password="123456" url="jdbc:mysql://localhost:3306/ooad?autoReconnect=true&&useSSL=false" driver="com.mysql.jdbc.Driver" var="db"/>

<sql:query var="result" dataSource="${ db}">
select * from article order by popularity DESC
</sql:query>

<div>
<table class="table2">
<tr>
<th>Title</th>
<th>Author</th>
<th>Time</th>
<th>Popularity</th>
</tr>
<c:forEach items="${result.rows}" var="row">
<tr>
<td><a href="Controller?page=view-article&title=${ row.title}"> <c:out value="${ row.title}"></c:out> </a></td>
<td><c:set var = "string" value = "${ fn:length(row.author)}"/><c:out value="${ fn:substring(row.author, 0, 3)}***${ fn:substring(row.author, string-8, string)}"></c:out></td>
<td><c:out value="${ row.time}"></c:out></td>
<td><c:out value="${ row.popularity}"></c:out></td>
</tr>
</c:forEach>
</table>
</div>

<footer>
2019 copyright&copy;mjh.mohamed
</footer>

</body>
</html>