Google App Engine Java 世界中的 MVC [英] MVC in a Google App Engine Java world

查看:20
本文介绍了Google App Engine Java 世界中的 MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要从 C# 转学 Java &ASP.NET MVC,我很想在 Java 世界中找到一个可以在 Google App Engine 上使用的等价物.我已经开始玩 FreeMarker甚至迈出了编写一个非常简单的框架的第一步.理想情况下,我不必做所有艰苦的工作,但肯定有人已经这样做了!所以我的问题是 - 有哪些框架对我来自 ASP.NET MVC 来说会很熟悉,我可以在 Google App Engine for Java 上使用它们.

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.

我想要的关键是:

  • 简单路由 - /products/view/1 映射到productid 为1 的products 控制器的视图操作
  • 模板引擎 - 一种轻松将ViewData"传递给视图的方法,并从视图轻松访问它,理想情况下,我很想避免任何过于 XMLy 的东西(因此我喜欢FreeMarker).
  • 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).

推荐答案

我目前正在使用 Spring MVC 开发 Google App Engine 应用程序.它比 ASP.NET MVC 成熟得多,所以您不应该失望.作为额外的奖励,您拥有 Spring 的全部 IoC 功能.

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.

对于视图层,我正在尝试 Velocity.它非常简单,但我还没有决定是否比 JSP 更喜欢它.我简要地看了一下 FreeMaker,但不喜欢我所看到的.如果您想远离 XML'y JSP 模板,我建议您尝试一下 Velocity.

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.

我在 GAE 上使用 Spring 遇到的唯一问题是文件上传.MultipartResolver 实现都依赖于临时文件目录.在编写我自己的实现之后,我又回到了在我的模型中无缝上传文件.

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.

这篇关于Google App Engine Java 世界中的 MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆