Skip to content

Commit ed03a59

Browse files
committed
BAEL-305: Some minor changes
1 parent 9c5404e commit ed03a59

5 files changed

Lines changed: 33 additions & 9 deletions

File tree

enterprise-patterns/front-controller-pattern/src/main/java/com/baeldung/enterprise/patterns/front/controller/commands/BookCommand.java renamed to enterprise-patterns/front-controller-pattern/src/main/java/com/baeldung/enterprise/patterns/front/controller/commands/SearchCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import javax.servlet.ServletException;
77
import java.io.IOException;
88

9-
public class BookCommand extends FrontCommand {
9+
public class SearchCommand extends FrontCommand {
1010
@Override
1111
public void process() throws ServletException, IOException {
1212
Book book = Bookshelf.getInstance()

‎enterprise-patterns/front-controller-pattern/src/main/java/com/baeldung/enterprise/patterns/front/controller/data/Bookshelf.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ private void init() {
2121

2222
public Book findByTitle(String title) {
2323
return books.stream()
24-
.filter(book -> book.getTitle().equalsIgnoreCase(title))
24+
.filter(book -> book.getTitle().toLowerCase().contains(title.toLowerCase()))
2525
.findFirst()
2626
.orElse(null);
2727
}
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
<p>Our Bookshelf contains this title:</p>
2-
<h2>${book.getTitle()}</h2>
3-
<p>Author: ${book.getAuthor()}</p>
4-
<input type="submit" value="Buy it: ${book.getPrice()}$">
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Bookshelf: Title found</title>
5+
</head>
6+
<body>
7+
<p>Our Bookshelf contains this title:</p>
8+
<h2>${book.getTitle()}</h2>
9+
<p>Author: ${book.getAuthor()}</p>
10+
<input type="submit" value="Buy it: ${book.getPrice()}$">
11+
</body>
12+
</html>
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1-
<p>Our Bookshelf doesn't contains this title:</p>
2-
<h2>${param.get("title")}</h2>
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Bookshelf: Title not found</title>
5+
</head>
6+
<body>
7+
<p>Our Bookshelf doesn't contains this title:</p>
8+
<h2>${param.get("title")}</h2>
9+
</body>
10+
</html>
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
<p>Sorry, this command is not known!</p>
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Bookshelf: Command unknown</title>
5+
</head>
6+
<body>
7+
<p>Sorry, this command is not known!</p>
8+
</body>
9+
</html>

0 commit comments

Comments
 (0)