todos) {
44 | req.setAttribute("todos", todos);
45 | try {
46 | req.getRequestDispatcher("/todos.jsp").forward(req, resp);
47 | } catch (Exception ex) {
48 | ex.printStackTrace();
49 | }
50 | }
51 |
52 | @Override
53 | public void onError(Throwable throwable) {
54 | if (throwable instanceof LCException) {
55 | if (((LCException) throwable).getCode() == 101) {
56 | // Todo class does not exist in the cloud yet.
57 | req.setAttribute("todos", new ArrayList<>());
58 | }
59 | req.setAttribute("todos", new ArrayList<>());
60 | try {
61 | req.getRequestDispatcher("/todos.jsp").forward(req, resp);
62 | } catch (Exception ex) {
63 | ex.printStackTrace();
64 | }
65 | }
66 | }
67 |
68 | @Override
69 | public void onComplete() {
70 |
71 | }
72 | });
73 | }
74 |
75 | @Override
76 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
77 | String content = req.getParameter("content");
78 |
79 | LCObject note = new Todo();
80 | note.put("content", content);
81 | note.save();
82 | resp.sendRedirect("/todos");
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 | index.html
9 |
10 |
--------------------------------------------------------------------------------
/src/main/webapp/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | LeanEngine
6 |
7 |
8 |
9 | LeanEngine
10 | This is a LeanEngine demo application.
11 | Routing example
12 | A simple todo demo
13 |
14 |
--------------------------------------------------------------------------------
/src/main/webapp/login.jsp:
--------------------------------------------------------------------------------
1 |
2 | <%@ page language="java" contentType="text/html; charset=UTF-8"
3 | pageEncoding="UTF-8"%>
4 |
5 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
6 |
7 |
8 |
9 | UserLogin - LeanEngine Demo
10 |
11 |
12 |
13 |
20 |
21 |
--------------------------------------------------------------------------------
/src/main/webapp/profile.jsp:
--------------------------------------------------------------------------------
1 |
2 | <%@ page language="java" contentType="text/html; charset=UTF-8"
3 | pageEncoding="UTF-8"%>
4 |
5 |
6 |
7 |
8 | UserProfile - LeanEngine Demo
9 |
10 |
11 |
12 | Current User Profile: ${currentUser}
13 |
14 |
17 |
18 |
--------------------------------------------------------------------------------
/src/main/webapp/stylesheets/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding: 50px;
3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
4 | }
5 | a {
6 | color: #00b7ff;
7 | }
--------------------------------------------------------------------------------
/src/main/webapp/time.jsp:
--------------------------------------------------------------------------------
1 |
2 | <%@ page language="java" contentType="text/html; charset=UTF-8"
3 | pageEncoding="UTF-8"%>
4 |
5 |
6 |
7 |
8 | Server Time - LeanEngine Demo
9 |
10 |
11 |
12 | Current time: ${currentTime}
13 |
14 |
--------------------------------------------------------------------------------
/src/main/webapp/todos.jsp:
--------------------------------------------------------------------------------
1 |
2 | <%@ page language="java" contentType="text/html; charset=UTF-8"
3 | pageEncoding="UTF-8"%>
4 |
5 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
6 |
7 |
8 |
9 | Todos - LeanEngine Demo
10 |
11 |
12 |
13 | TODO list
14 |
18 |
19 |
20 |
21 |
22 |
23 | content |
24 | objectId |
25 | createdAt |
26 |
27 |
28 |
29 |
30 |
31 | ${todo.content} |
32 | ${todo.objectId} |
33 | ${todo.createdAt} |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/system.properties:
--------------------------------------------------------------------------------
1 | java.runtime.version=11
2 |
--------------------------------------------------------------------------------