Richard Reese wrote:Cor,
I share your frustration. Sorry but the book does not contain that information. Netbeans and Glassfish were used for the examples and there are some details on how to use these tools. Other than those two products there is nothing that would point you to other products.
Cor Takken wrote:I am a firm believer in separating the presentation layer from the calculation layer. (As an aside: I acknowledge that there are more official terms for these principles, however for the sake of argument I will use these terms). In that believe I have a bit of a problem having for-loops, if-constructions etc. in the presentation layer. This makes the presentation layer no longer pure presentation but now also contains some form calculation and that has a risk of creap (pun intended) of business logic in the presentation layer. However, this I have noticed in the field that this creep is commonplace in JSF and I (will have to) accept the fact that the presentation layer in JSF does contain some programming logic.
You are right to be cautious about using logic in Facelet pages. In fact, I have been touting the complete absence of scriptlets in Facelets as one of its selling points. There are still a few corner cases that remain unresolved in using JSTL conditionals or iterators in Facelet pages, mostly revolving around state that changes between requests. As far as patterns or practices to refactor an existing occurrence of the use of conditionals and iterators I do have some suggestions.
Let's take conditionals and iterators separately. First, conditionals. The most common use of conditionals is to show/hide portions of the page. This usage is generally safe, especially when you value bind to the view scope.
Next on to iterators. If at all possible, use ui:repeat instead of c:forEach. ui:repeat is backed by an actual JSF component, while c:forEach is a tag handler. Because ui:repeat is a JSF component, it does a better job of managing its state.
If anyone else has something to share on this, please do!
Thanks for your interest.
Ed
Bear Bibeault wrote:
It is spelled out in bold text in the very first entry in this topic. I'm not sure how much more clear it could have been made.
Just click the New Topic button.
Indeed. The book promotions on JavaRanch are very informative and useful.
Bear Bibeault wrote:Please remember that this topic is for welcoming the authors -- not for asking questions. Please ask questions in a separate topic,
Posts in this topic are not eligible for the book promotion!