Rails e.g. Views for Spring web application

I am planning a web application and am currently evaluating the Framework. In the past, I worked a lot with Ruby on Rails, but since this application will rely on a lot of code already written in Java and will work in the Application Server infrastructure, it will also be in Java.

So far I have looked at a few frameworks, and Spring MVC (3.0) looks the most promising for the planned Ive. I like how many concepts are similar compared to Rails: front controller, push views and quiet URLs.

However, I'm still not sure about the review part. I want to have one (or more) application templates that have the basic structure of my site, with logo, footer, etc. This template will have some dynamic areas, such as a navigation section, etc. (In Rails speek, yield: navigation) Some of the view code, especially the form, will be reused; something like partial would be nice.

My first page might look like this:

+-------------------------------+ | Application.tmlp | | | | +-------------------------+ | | | index.tmpl | | | | | | | | +-------------------+ | | | | | | | | | | | login_partial.tmpl| | | | | | | | | | | +-------------------+ | | | | | | | +-------------------------+ | | | +-------------------------------+ 

So far I have found Velocity, Freemarker and Tiles, but I'm still not sure what works best for me. I like the concept of a template because I would like some designer to create templates.

Something that would be nice, but not as important as the concept of the template, is automatically created by links like link_to helper from rails:

 link_to "Profile", :controller => "profiles", :action => "show", :id => @profile 

What kind of implementation for Spring MVC is closest to this? Many thanks!

+6
java spring-mvc web-applications
source share
4 answers

Look at grails , in it sitemesh , I think this is what you are looking for.

+6
source share

Some useful videos:

In fact, you are spoiled in rails for this kind of thing, it will require more effort with java, all the seams, unfortunately, I say (I just started the transition from java to rails3).

You can also take a look at the racks.

+2
source share

A great framework for creating templates for JSPs is Apache Tiles . It can be easily integrated into Spring Web MVC applications.


Alternatively, if you have experience with Ruby on Rails, you can look at Spring Roo by adding a “configuration convention” and a code generator layer on top of Spring, similar to what Rails does for Ruby applications.

+2
source share

This library does pretty much what you want. It is very similar to rail style templates.

http://code.google.com/p/jst4j/

0
source share

All Articles