Java MVC Web development framework? - java

I want to develop a website with java but I'm absolute beginner in java web development.
I want to use a framework that uses the MVC pattern and Ajax.
I did some search and found that Spring or Struts are suitable but I'm not sure.
could you please recommend a framework?

Play Framework might be a good option because of its incredible simplicity.

I'd recommend Spring:
Developing a Spring Framework MVC application step-by-step

The Stripes Framework is also worth consideration and can be used along with Spring.
http://www.stripesframework.org
It's easy to use and easy to configure. Unlike Struts, which is fairly old hat these days.
There are a plethora of frameworks now and it's worth checking each one that will suit your needs. It's a personal thing and it's good that we're not all restricted to a few.

JRapid is very easy to use. You'll get a working application in minutes and it generates AJAX powered user interface.

I work with Spring Webflow - technology based on Spring MVC. Webflow is described in official help pretty well. Personally, it think Webflow is much more usable than bare Spring MVC, however there are always someone who disagrees.
Moreover Spring (not talking about MVC specifically) can be used outside of web projects, so it seems to me it is advantage of Spring.
Cannot say anything about Struts.

I would recommend GRAILS for fast rapid web application development, that includes scaffolding functionality and web page generation based on data models.
https://grails.org/learn
It is the fastest way for MVC developers.

Related

Java Equivalent for ASP.NET MVC Areas

Areas, in ASP.NET MVC, are handy for breaking a site into smaller, manageable components at a higher level than controllers. They are like mini-MVC pieces within a web application.
Is there an equivalent concept in any Java MVC framework to ASP.NET Areas?
If not, are there any suggestions on best practices when emulating their functionality in a Java MVC framework?
Try Spring MVC. This may be fulfill your wish.
Look at JSP Tiles and Velocity Templates. Tiles should look similiar to Areas.
Take a look on this Web Framework for java: playframework
As such, Java EE does not provide an out of box solution based on MVC but there are many OpenSource projects that have created a solution which implement a MVC framework - try the latest Spring and Struts versions.

MVC or Rest or Both

I in the process of designing the server side of a web-based user interface that will be very JavaScript intensive.
I originally thought of going with an MVC solution, but now I am thinking I want to use a REST-based solution such as Jersey or Restlets.
Is this often an one or the other type decision or can they be a combined solution?
Thanks,
Mike
MVC is about how the inner side of your app works.
REST is about how your app "talks" with other apps.
You can combine them.
A lot of modern frameworks actually are MVC based and make implementing REST web services easy: Ruby on Rails, Java Spring Framework with SpringMVC , Django, Backbone.js
One of the best Java frameworks I've seen for building MVC webapps with the ability to support REST is SpringMVC. This blog post outlines the REST capabilities in SpringMVC since version 3.0. I've developed REST services using SpringMVC and Jersey, and they are fairly comparable.
They are patterns / solutions to solve different problems.
REST sanitises & simplifies addressing access to features of a web application, for users, client software, etc.
MVC provides a means to organise your application code, making it easier to maintain.
MVC is an architectural design pattern for the layers of your application.
The folder structure:
Models/YourClassModel.php
Views/Home/HomeView.php
Controllers/Controller.php
index.php
The application style REST is the Representational State Transfer of the application.

Downsides of using Stripes+Spring vs Spring MVC

I am coming from Struts 1 world. Now I am starting a new project and we are using Spring.
I could use Spring MVC, but seeing how simple it is to use Stripes (no xml is a big plus) I am tempted to use that with our brand spanking new Spring web application. I have no experience in either Stripes or Spring MVC (apart from basic CRUD application).
Question is, what are the downsides of using Stripes as opposed to Spring MVC? Several parts of the application will be RESTful, will it make it harder if we use Stripes? What about validation? I suppose Stripes will be easier to implement, no?
Stripes is a great framework. It's been our framework of choice the past few years and has yet to disappoint.
However, if you mean RESTful in the sense that you want to use HTTP PUT/DELETE, etc. Stripes might not be your answer. I think you'd have to set up Filters, or additional logic in your Beans, it wouldn't be straight-forward (as it seems to be in Spring from a cursory googling).
On the other hand, if you mean things like /app/delete/3 or /app/update/4 & pass POST params, Stripes is an excellent choice.
The Stripes book (Pragmatic Programmers) explains the framework well, and has a chapter on using DI with Spring. All the normal bells and whistles (including validation) are excellent.

Which framework to choose?

I was thinking which framework would be a good choice to go into. I'm focusing on java apps and tested spring, grails and seam so far. I've also looked aboard java and gave ruby on rails a try too.
In future I will be focusing on portlet development which I've gone through already without a complete framework (just hibernate).
Maybe someone could share some experiences? Or point me to a corner which I don't looked in so far?
Regards and thanks for reading ;)
If you're doing this out of curiosity and to learn something new, rather than to meet specific requirements for a specific project, maybe you'll enjoy the Play! Framework. It contains a lot of stuff from other frameworks and is designed to get you up and going very quickly, with short development cycles and not a lot of arcanae.
Their stated purpose is to be "by Web developers for Web developers". They intend to put the fun back into Web programming.
This sounds good and I've read a few nice things about it in fora and blogs, but I haven't tried it myself yet so that's all the recommendation I can give.
Grails has a plugin for developing portlets, described here.
If you consider Groovy or Grail, you might consider ZK, too. It is an Ajax framework integrated well with Groovy and Grail.
I'd say you go with a framework that targets the programming language you're most proficient in. If you already are good in Java, and you're a quick learner ( to learn Groovy ), Grails could be a good choice.
If you'd like to go with another scripting language, say Ruby/Python, then choose Rails or Django, or Pylons ( the list could go on here ).
If you're going for a Java only framework, I'd go with Spring MVC.
You should have a look at the play framework (SO question).
Finally a Java framework made by Web developers. Discover a clean alternative to bloated enterprise Java stacks. Play focuses on developer productivity and targets RESTful architectures.
I was thinking which framework would be a good choice to go into. I'm focusing on java apps and tested spring, grails and seam so far. I've also looked aboard java and gave ruby on rails a try too.
FYI - Grails is using Spring and Hibernate underneath; SEAM uses JSF and Hibernate.
Grails is the Java equivalent of RoR. It's based on the same idea: "convention over configuration".
It's also important to be clear that Spring is far more than a mere web MVC framework. It's based on DI and AOP and encompasses persistence, remoting, enterprise services, etc. It supports portlet MVC, which is a plus given your requirements.
Personally, I would recommend straight Spring over any of your choices so far if you stick with Java. It's important to know something about what's going on under the covers. If you know Spring well, Grails will be easy.
I'd use Wicket rather than Play! because Play! requires Python as a semi-dependency. With Wicket, you only need Apache and Java and thats it.
I suggest you also check out here:
http://gokhan.ozar.net/best-java-web-frameworks/

Helping a beginner for java web application

I have pretty big background of .net, and I've decided that i want to port one of my websites to Java. (now with the asp.net MVC craze, I've figured I'd better learn a more mature approach to MVC).
i've downloaded eclipse (easyeclipse distro to be exact, and am ready and willing to develop my first website in java).
i've programmed j2me application before, so i know the language and some of the framework.
can someone guide me? any advice?
Although I'm not very aware of "asp.net mvc" is all about, I would suggest you to take a look at Spring it may be interesting.
Probably is too complicated at the beginning but when you get the concept it turns out very easy to follow.
Spring has 5 core modules ( which I don't remember exactly ) but they were like:
AOP
ORM
MVC
Core
( some other I'm missing here )
The MVC part uses a lot of annotations to make life easier. There's a very big community around Spring.
Here's an introductory article about spring.
Java has a ton of frameworks you can choose from. The technology stack that I use for my Java development is either:
Spring for IoC.
Hibernate for the data layer.
Struts2 for the MVC framework.
I have also swapped out spring and used Guice for the IoC.
Spring also has MVC, but I tend to like Struts2 better.
I'd recommend looking at Grails, it lets you become comfortable with all the java libraries and frameworks like Spring, SpringMVC, Hibernate, SiteMesh, and so on but gives you a much better DSL for web applications and much more concise code with the Groovy language (think of it as Java with dynamic typing, blocks, closures, and so on).
If you'd rather stick to pure Java I'd recommend looking at the Stripes framework and the following book:
http://pragprog.com/titles/fdstr/stripes
If you interested in web applications specifically, I would recommend using MyEclipse http://www.myeclipseide.com. Basically, this is a version of eclipse with all the web server integration and functionality built in. I've been using it for a few years and it's much easier to develop with than with plain vanilla eclipse. Depending on how much your going to use it, you have to decide whether the $55 annual subscription is worth it for you.
I'm a little confused. does spring framework actually a full blown framework? doesn't Java already have a framework? (by framework i mean all those misc libraries).

Categories

Resources