views:

938

answers:

9

So I've played some with the new, not yet final release of ASP.NET MVC framework and I find it to be very nice and elegant. However at work we are tied to Java for the time being, so I'm wondering this: is there a port of the framework out there for Java people like myself? I realize that webforms isn't going to be available unfortunately but what about the routing framework?

+1  A: 

Actually ASP .Net MVC is more a port from other succesfull framework to the .Net platfrom.

You could actually run Rails over jRuby.

Or I heard great thing about JBoss Seam.

pmlarocque
A: 

The Oracle ADF for Java EE is a fully Model-View-Controller oriented web framework. You'll also need Oracle JDeveloper to work with it.

I don't recommend the framework however (although I adore JDeveloper for everything else Java)

Matthew Ruston
+1  A: 

Check out the stripes framework. It's a request based Model View Controller framework that works really well, and is easy to use.

ScArcher2
+5  A: 

Take your pick:

http://en.wikipedia.org/wiki/Model-view-controller#Java

Hates_
A: 

@pmlarocque,

That's something that I've read somewhere; the dev guys behind asp.net MVC obviously were inspired by RoR and I think they did good. It's fun, straight forward and very productive programming with the framework. I wonder if they looked at Wicket too?

Too bad. I was hoping someone would be working on a Java port. Maybe it's to early still. After all, it's not even been released yet!

Adam Asham
+2  A: 

Take a look at Spring MVC. Like Spring itself, it's pretty easy to use. The official Spring docs contain a step-by-step tutorial on Spring MVC that is very good.

I'm not that familiar with ASP.NET MVC, but it ought to be pretty similar.

You implement a Controller that contains a handleRequest(HttpServletRequest, HttpServletResponse) method, which returns a ModelAndView object. The response is then dispatched to your view (probably a jsp file), allowing you to completely seperate code from the actual JSP file.

I know that ASP.NET MVC automatically maps requests to controllers by the URL, and different URLs map to different "actions" (like Ruby on Rails, I think?) - Spring MVC doesn't do this (unless you change the behavior of DispatchServlet, I think). Instead you map all *.htm requests (or *.jsp, or *.do, or whatever extension you want) to Spring's DispatchServlet, which reads the ApplicationContext (a XML file) to determine which Controller to map to your hello.htm request.

Spring MVC also gives you a series of other Controllers you can use if you are looking to add more functionality, such as SimpleFormController and AbstractWizardFormController to create wizard-like forms with multiple pages/flows.

I'm looking to use Spring MVC at work to replace a series of apps that are nothing but several dozen JSP files, with no middle or business layers, code that lives side-by-side in scriptlet tags next to HTML content. It's a maintenance mess. I'm excited to see what Spring MVC will do for us in replacing this.

matt b
+1  A: 

@matt b

I'm in a situation similar to yours. We have an old application written in JSP, and JSP only! The developer who wrote it insisted on using JSP since JSPs are compiled into servlets in the end anyways shrugs. It's a nightmare to add features and to maintain such a code base.

What I do not like with most Java frameworks is all the meta-data configuration.

Adam Asham
A: 

Oops!! Why would you want asp.net MVC in Java EE? MVC is old news in Java EE and related technologies. Virtually every web framework in Java EE is based on MVC concept. Why would you prefer a less mature asp.net solution to what is available in Java EE from a long long time.

nash
Because I like the asp.net mvc framework but prefer the Java platform! :)
Adam Asham
A: 

Take a look at Play--http://www.playframework.org/