public class User {
private String name;
private int age;
}
html
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
</html>
public class UserController {
public static void getUserInfo(Request request, Response response) {
String userId = request.getParameter("userId");
User user = UserModel.getUserById(userId);
response.addAttribute("user", user);
response.render("user_view");
}
}
properties
route.user_info = /user/{userId}
database.url = jdbc:mysql://localhost:3306/mydb
database.username = root
database.password = password
template.engine = freemarker
public class Application {
public static void main(String[] args) {
MojaveServer server = new MojaveServer();
server.registerRoute("/user/{userId}", UserController.getUserInfo);
server.start();
}
}