wood burning stoves 2.0*
The moose likes Struts and the fly likes JSF limitations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "JSF limitations" Watch "JSF limitations" New topic
Author

JSF limitations

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Does JSF have limitations? :roll:


Groovy
Basel Al-Mustafa
Greenhorn

Joined: Nov 27, 2004
Posts: 27
Hi,

I have read in the CoreJSF book that it can only send POST request. Did not investigate the case and do not know to what extent it is true. This can be considered a limitation specially if you want to bookmark a thread in a forum or an item in a store.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

If someone were to say JSF had no limitations they would be on crack. Everything has limitations. Although you can't directly do a <form method="GET"> to the server, you can send query strings (ie http://localhost/sort.jsp?foo=bar) and then retrieve the query string(s) by accessing the HttpServletRequest via the FacesContext().getExternalContext().getRequest() method.

If I had to pick out a limitation of JSF that annoyse me the most it would be this:

There is no PostBack check. What I mean is when you call a faces page and that page requires dynamic data, be it from a database or whatever, the information is loaded before the page is rendered. All fine and dandy. The problem is if you submit the form in anyway and the page has to redisplay itself again because of a validation error maybe, the dynamic data is loaded again. So your database is hit again or your XML files are read again or whatever your doing to get your data.

ASP.NET has a very elegant method for handling this. There is a pageLoad method and you can do something like:



And in that code block is where your dynamic data is called from. So if the page is posted back to itself you don't waste trips to the database again and all the data is stored in whatever state (request, session, etc). JSF needs this and I have heard there will be something in the next release. I know that some vendors have implemented this feature manually. But to me it's something that should be the default behavior. You can work around this by surrounding your data calls with state checks to determine if you are viewing the same page again or not but it's just sloppy and a hack way of doing it.


GenRocket - Experts at Building Test Data
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Hitting the server even for a minor validation sucks.


- Varun
Cay Horstmann
author
Ranch Hand

Joined: Nov 14, 2004
Posts: 114
    
  10
Hitting the server even for a minor validation sucks.


There are two issues here:

1) Hitting the server for routine validations that can be done on the client with JavaScript. Core JSF shows how to make use of the Struts validator JavaScript--that helps with simple cases. For more complex validations of field dependencies, you'd have to write custom components that generate their own JavaScript--see the spinner example in Core JSF.

2) Unnecessarily hitting the database when reposting a page. If this is a concern, you could install a phase listener. But I agree it gets ugly.

Cay


Author of Java 8 for the Really Impatient
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Cay Horstmann:
2) Unnecessarily hitting the database when reposting a page. If this is a concern, you could install a phase listener. But I agree it gets ugly.

Cay


Yes it doesn. I attempted to do just that but gave up.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Will these limitation be taken care of in future versions?
Venkat Sadasivam
Ranch Hand

Joined: May 10, 2008
Posts: 139
A critic view on JSF

http://venkatsadasivam.wordpress.com/2008/04/28/a-critic-view-on-jsf-framework/


“Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ”<br>
-Martin Fowler
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF limitations
 
Similar Threads
Front Controller Design Pattern
JPA and JSF for SCEA 5
How to create PopUp in jsf
JSF is the answer? I don't think so...
Spring+ hibernate or JSF+EJB3