Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF limitations

 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does JSF have limitations? :roll:
 
Basel Al-Mustafa
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hitting the server even for a minor validation sucks.
 
Cay Horstmann
author
Ranch Hand
Posts: 172
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will these limitation be taken care of in future versions?
 
Venkat Sadasivam
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A critic view on JSF

http://venkatsadasivam.wordpress.com/2008/04/28/a-critic-view-on-jsf-framework/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic