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?
Actually ASP .Net MVC is more a port from other succesfull framework to the .Net platfrom.
You could actually run Rails over jRuby.
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)
Check out the stripes framework. It's a request based Model View Controller framework that works really well, and is easy to use.
@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!
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
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.
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.