-
Notifications
You must be signed in to change notification settings - Fork 7
Sort article by popularity #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
salty-chen
wants to merge
2
commits into
master
Choose a base branch
from
Jifry-201836900119-Chenyuxuan-Article-Recommend
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,173 @@ | ||
| <%@ page language="java" contentType="text/html; charset=ISO-8859-1" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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©mjh.mohamed | ||
| </footer> | ||
|
|
||
| </body> | ||
| </html> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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©mjh.mohamed | ||
| </footer> | ||
|
|
||
| </body> | ||
| </html> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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