Spring MVC 3 有视图组件吗?
我正在为一个项目学习 Spring 3 MVC,我很快就会为一个客户开始,但我找不到它是否支持视图组件(类似于 portlet)。
理想情况下,该解决方案类似于 Rails,其中使用参数(对象或视图名称)调用“渲染”来渲染组件。
或者在视图模板中包含类似以下内容的内容
<component name="search" paramA="1" paramB="2"/>
,在本例中,有一些内容会在类路径中搜索组件“Search”并使用参数对其进行初始化。
理想的解决方案应该是0配置。也许解决方案是编写一个自定义标记库来为我完成此操作,但我想知道是否已经完成了一些工作。
如果有人知道从 Rails 开发人员角度解释 spring mvc 3 的书籍/教程,我将非常感激。
I'm learning Spring 3 MVC for a project I'll start soon for a client and I can't find if it supports view components (similar in a way to portlets).
Ideally the solution would be similar to Rails, in which invoking "render" with a parameter (object or view name) renders the component.
OR to have something like the following in the view template
<component name="search" paramA="1" paramB="2"/>
and in this case, there's something that searches for the component "Search" in the classpath and initializes it with the parameters.
The ideal solution should have 0 configuration. Maybe the solution would be to write a custom taglib that does this for me, but I'm wondering if there's something already done out there.
I would be really thankful If anyone knows about a book / tutorial that explains spring mvc 3 from a Rails developer point of view.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Spring MVC 不是一个组件框架——它的级别太低了。
Java 世界充斥着更多基于 Web 的组件框架,比您可以摇动的小部件还要多。尝试(排名不分先后)JSF、Spring WebFlow、PlayFramework、Vaadin 等。
如果您已经熟悉 Rails,那么显而易见的选择是 Grails - 它受到 Rails 方法的启发,使用 Groovy 而不是 Java,但运行于Java VM,并且与其他 Java 东西集成得很好。
Spring MVC isn't a component framework - it's too low level for that.
The Java world is awash with more web-based component frameworks than you can shake a widget at. Try (in no particular order) JSF, Spring WebFlow, PlayFramework, Vaadin, etc.
If you're already familiar with Rails, then the obvious choice is Grails - it's inspired by the Rails approach, uses Groovy rather than Java, but runs on the Java VM, and integrates with other Java stuff well.