views:

826

answers:

8

Does anyone know of a simple Web MVC framework and Web Server for Java that is open source?

This is intended as a simple web server and framework for students in a tutorial class.

It's important these both the web server and MVC framework are simple, OSS so students can easily peer under the hood and the tutors can easily support it, learn it and teach it.

UPDATE The suggestion I can avoid the single jar issue by unpacking several jars and joining them into one is a good suggestion. I'll definitely take it, and thus relax the single jar requirements

+5  A: 

If having a single jar is important to you, you can just unjar multiple jars and then recombine into one single jar (watching out for any duplicates or file clashes).

That may be easier than compromising your MVC choice for the single-jar requirement.

Brian Agnew
I think satisfying the single jar requirement will be way harder than any saving it will produce down the track.
CurtainDog
+3  A: 

You could have a look at Stripes, which does not have any compile time dependencies (apart from itself, apparently) at all and only requires COS and Commons Logging during runtime.

It's also very lightweight and quite easy to pick up.

springify
+2  A: 

If its for teaching MVC why don;t you explain them by using JSP and Servlet on Tomcat. If you want to teach using some framework then in my opinion JSF on tomcat is the easiest as not much configuration required and the backend code is also only plain Java and no framework specific API.

Bhushan
I think JSP is too heavyweight, and imho, out of fashion. MVC is a better pattern. Would like to hear your opinion on why MVC is a bad idea.
CVertex
I didn't say MVC is a bad idea. I was saying teach MVC concepts using plain JSP and Servlet if not use JSF. All the java web frameworks ultimately rely on core JSP and Servlet technology.
Bhushan
+4  A: 

I'm very impressed with the Play! Framework which I think would meet most of your requirements in terms of MVC. It's a lot like Rails etc, and supports annotations-based Hibernate persistence out of the box. The only three 'odd' things worth mentioning are that it:

  1. I think it has its own built in implementation of properties (using reflection and byte code modifications)
  2. It uses exceptions for flow control
  3. Its templating may be a little basic for some requirements, but on the whole it's fine for simpler stuff.

None of these is a showstopper in terms of producing a good website quickly, but points 1 and 2 may put you off if you are trying to teach Java at the same time.

Rich
The Play! Framework does seem like the most simple of the Java MVC frameworks.
wm_eddie
A: 

If you're teaching someone about fixing cars, you could certainly start with a Briggs & Stratton lawn mower engine and work your way up. I'd suggest starting them with something that's immensely popular instead--a Honda Civic, in our metaphor.

Starting with an immensely popular framework will yield better Internet resources and will have the benefit of lots of others who had run into the same problems before. Also, using something used in the real world and which would appear in job postings isn't a bad way to create productive members of the development community.

I'd suggest Spring MVC. If you want to hide the IoC, that's pretty easy to do as well. A sample:

package samples;

public class SampleController extends AbstractController {

    public ModelAndView handleRequestInternal(
        HttpServletRequest request,
        HttpServletResponse response) throws Exception {

        ModelAndView mav = new ModelAndView("hello");
        mav.addObject("message", "Hello World!");
        return mav;        
    }
}
Joe Liversedge
Spring is definitely too heavy handed. We're cramming alot into this subject, and a heavyweight framework already adds to the immense learning they must endure
CVertex
+1  A: 

Try the ultra simple java based web MVC framework VRaptor 2. My 5 year old niece was able to write a simple webapp and get it up and running within 7 minutes (with some coaching of course). No joke !

Aries McRae
A: 

What do you guys think of Wicket ?

djangofan
A: 

simple mvc

 package app.controllers;
    import mvc.*;
    class mycontroller implements Controller {
        public View Controller() {
            return new View("myview");
        }
    }

http://www.webmahsulleri.com/yazilim-mimarileri/tasarim-kaliplari/simple-mvc-ile-java-uzerinde-mvc-uygulamalari/