MVC在Google App Engine Java世界中 [英] MVC in a Google App Engine Java world
问题描述
我从C#& ASP.NET MVC,我很想在Java世界中找到一个可以在Google App Engine上使用的等价物。我已经开始使用 FreeMarker 进行游戏了甚至为编写一个非常简单的框架迈出了第一步。理想情况下,我不需要做所有的努力,但有人必须已经做到了!所以我的问题是 - 那里有什么框架可以让我熟悉来自ASP.NET MVC,我可以在Google App Engine for Java上使用它们。
我想要的关键是:
- 简单路由 -
/ products / view / 1
被映射到产品控制器的视图操作,产品为1 - 模板引擎 - 一些轻松的方式将'ViewData'传递给视图,并从视图中轻松访问它,理想情况下,我很乐意避免任何太XMLy的东西(因此,为什么我喜欢 FreeMarker )。
我目前正在研究Google使用Spring MVC的App Engine应用程序。它比ASP.NET MVC更成熟,所以你不应该感到失望。作为额外的奖励,您拥有Spring的整个IoC能力。
对于视图层,我尝试使用Velocity。这很简单,但我还没有决定是否会更喜欢JSP。我简要介绍了FreeMaker,但不喜欢我所看到的。如果你想远离XML'y JSP模板,那么我建议你给Velocity一个旋转。
我在GAE上遇到的唯一问题是文件上传。 MultipartResolver实现都依赖于临时文件目录。在编写我自己的实现之后,我回到无缝上传我的模型中的文件。
I'm coming to Java from C# & ASP.NET MVC, I'd love to find an equivalent in the Java world that I could use on the Google App Engine. I've already started to have a play with FreeMarker and even made the first steps towards writing a very simple framework. Ideally I wouldn't have to do all the hard work though, someone must have done this already! So my question is - what frameworks are there out there that would be familiar for me coming from ASP.NET MVC and I could use them on Google App Engine for Java.
The key things I'd want are:
- Simple Routing -
/products/view/1
gets mapped to the view action of the products controller with the productid of 1 - Template Engine - some way of easily passing 'ViewData' to the view, and from the view easily accessing it, ideally I'd love to avoid anything that is too XMLy (thus why I like FreeMarker).
I am currently working on a Google App Engine app using Spring MVC. It is a lot more mature than ASP.NET MVC so you shouldn't be disappointed. As an added bonus you have the whole IoC power of Spring.
For the view layer I am trying out Velocity. It is pretty simple but I have yet to decide if I will prefer it over JSPs. I had a brief look at FreeMaker but didn't like what I saw. If you want to stay away from XML'y JSP templates than I recommend you give Velocity a spin.
The only problem I have had with Spring on GAE is file uploading. The MultipartResolver implementations both rely on a temporary file directory. After writing my own implementation I'm back to seamless uploading of files in my models.
这篇关于MVC在Google App Engine Java世界中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!