BAEL-305: Some minor changes

This commit is contained in:
Christian Rädel 2016-08-31 03:38:46 +02:00
parent 9c5404ead8
commit ed03a59711
5 changed files with 33 additions and 9 deletions

View File

@ -6,7 +6,7 @@ import com.baeldung.enterprise.patterns.front.controller.data.Bookshelf;
import javax.servlet.ServletException;
import java.io.IOException;
public class BookCommand extends FrontCommand {
public class SearchCommand extends FrontCommand {
@Override
public void process() throws ServletException, IOException {
Book book = Bookshelf.getInstance()

View File

@ -21,7 +21,7 @@ public class Bookshelf {
public Book findByTitle(String title) {
return books.stream()
.filter(book -> book.getTitle().equalsIgnoreCase(title))
.filter(book -> book.getTitle().toLowerCase().contains(title.toLowerCase()))
.findFirst()
.orElse(null);
}

View File

@ -1,4 +1,12 @@
<p>Our Bookshelf contains this title:</p>
<h2>${book.getTitle()}</h2>
<p>Author: ${book.getAuthor()}</p>
<input type="submit" value="Buy it: ${book.getPrice()}$">
<!DOCTYPE html>
<html>
<head>
<title>Bookshelf: Title found</title>
</head>
<body>
<p>Our Bookshelf contains this title:</p>
<h2>${book.getTitle()}</h2>
<p>Author: ${book.getAuthor()}</p>
<input type="submit" value="Buy it: ${book.getPrice()}$">
</body>
</html>

View File

@ -1,2 +1,10 @@
<p>Our Bookshelf doesn't contains this title:</p>
<h2>${param.get("title")}</h2>
<!DOCTYPE html>
<html>
<head>
<title>Bookshelf: Title not found</title>
</head>
<body>
<p>Our Bookshelf doesn't contains this title:</p>
<h2>${param.get("title")}</h2>
</body>
</html>

View File

@ -1 +1,9 @@
<p>Sorry, this command is not known!</p>
<!DOCTYPE html>
<html>
<head>
<title>Bookshelf: Command unknown</title>
</head>
<body>
<p>Sorry, this command is not known!</p>
</body>
</html>