Re: Recommendations for a web application framework?



Chris Smith schrieb:
Alan Meyer <ameyer2@xxxxxxxxx> wrote:
Do you or Chris think that using JSF is better than using, say,
Webwork or Spring? Or perhaps that it's just another approach?

I definitely feel that JSF is a better idea than Spring-MVC. I don't know much about WebWork, but I'm pretty skeptical of new revolutionary web application frameworks these days. One huge advantage of JSF (in my view) that applies versus most anything else is that it is the standard framework for web application development with Java. As such, I would need a pretty good reason to switch away from it. I haven't seen anything else that really is such a good reason.

JSF does an excellent job of separation of concerns.

Do you mean separation of HTML and Java or separation of business objects and view code? In my opinion, even PHP template libraries like TAL do a better job of separation in both respects than JSF.


[...] With JSF, I can actually build my entire Java code without having to think about the view layer at all; [...] In almost everything
else, you have to do this naming convention junk between "form beans" and HTML forms, and the form beans are not really all that abstracted from basic HTTP parameter handling.

That's Struts. But Struts is the oldest (and most outdated) of all Java Web Frameworks I know. There are many Frameworks that hide HTTP entirely. With some, you don't even have to care about request-response cycles: Let's say that I want to display a number on a web page, and increase the number by 1 everytime the user clicks a link. Using Struts, you would probably store the value in the session.

In a more advanced framework, it might look like this:

Java code:

public class CounterPage extends WebPage {

public int counter = 0;

public CounterPage() {
add(new Link("increase") {

public void onClick() {
counter = counter + 1;
}
});
add(new Label("counter", new PropertyModel(this, "counter")));
}
}


HTML:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml";
xmlns:wicket="http://wicket.sourceforge.net/";>
<head>
<title>Counter Page</title>
</head>
<body>
<span wicket:id="counter">[counter value will appear here]</span>
<a wicket:id="increase">increase counter</a>
</body>
</html>


Model and view are glued together by simple Classes. In this case, a OGNL expression is used.


JSF is just too complicated for my taste, but it certainly is the best choice for large applications because it is the official standard, has support of many vendors and a many available programmers.


Timo
.



Relevant Pages

  • Re: quickest route to java web form
    ... >>>I'm confused by all the Java web frameworks out there. ... >> A quicker way to create HTML ... > forward the request to a JSP for presentation. ...
    (comp.lang.java.programmer)
  • Re: quickest route to java web form
    ... A quicker way to create HTML ... Java and basic HTML. ... the RequestDispatcher. ... That way you understand what the frameworks really do. ...
    (comp.lang.java.programmer)
  • Which do I use for web design?
    ... I saw "regular" jsp ... scriplets, servlets emitting html, JavaBeans, JSTL, EL, JSF, and then ... Outside of using frameworks, what would you use? ... emitted HTML. ...
    (comp.lang.java.programmer)
  • Re: [PHP] Re: developer seeking document writer
    ... documented and can output HTML but... ... about other frameworks, is that you find yourself mixing PHP and HTML, ...
    (php.general)
  • Re: Which do I use for web design?
    ... scriplets, servlets emitting html, JavaBeans, JSTL, EL, JSF, and then ... Outside of using frameworks, what would you use? ... emitted HTML. ... So, it appears that I would use JavaBeans, servlets to ...
    (comp.lang.java.programmer)