I’m learning how to make a google appengine app in Java now, and in their getting started guide, they use JSP’s, but this seems to put a step back to my old days when I didn’t know anything about MVC or separation of concerns.
I don’t want to put code inside a template, and would rather use something similar to the django templates or jinja, the way you do in the python sdk. What’s the best framework to do this?
I’m following the guestbook eexample in the getting started guide, where they tell you to make a JSP like this:
<html>
<body>
<%
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
if (user != null) {
%>
<p>Hello, <%= user.getNickname() %>! (You can
<a href="<%= userService.createLogoutURL(request.getRequestURI()) %>">sign out</a>.)</p>
<%
} else {
%>
<p>Hello!
<a href="<%= userService.createLoginURL(request.getRequestURI()) %>">Sign in</a>
to include your name with greetings you post.</p>
<%
}
%>
</body>
</html>
but all those <% and %>s remind me of including PHP code in HTML pages, which is not the way I want to do this. Is there a way so I could create a view object, passing it some values, which will insert those into a template?
According to Google App Engine Wiki, JSP +JSTL is supported so there’s no need of Scriptlets at all.
If you want a clean MVC architecture, maybe you should use a Framework that supports the pattern. The wiki says that Struts it’s supported and also Spring MVC, so you can choose the one that suits your needs.