First of all: I welcome every piece of information regarding JSF, so I thank the authors for sharing their knowledge with us.
Now for my question: 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.
Is there to the knowledge of the authors one or a number of patterns which will help us reduce the number of these constructions or helping the developers limitting these constructions to the ones which will have the least risk of changing once the application is in production? My fear (backed by some experience) is that when once an application is in production the impact of maintenance is worsened by the presence of logic in the presentation layer.
Thanks for taking the time to answer this question.
Cor
SCJP 1.5
Dolphins are grey, but they dream in colour.
Your book sounds great. Can't wait to read it. I'm pretty new to JSF, etc. I'm working on an application now where I need to store an ArrayList in a bean and then be able to create dynamic fields on the JSP page using that ArrayList.
Wendy Bossons
Greenhorn
Joined: Sep 04, 2009
Posts: 3
posted
0
[Question removed. Please ask questions in a new topic.]
Ed Burns
author
Ranch Hand
Joined: Sep 11, 2006
Posts: 69
posted
0
Thanks to Jeanne Boyarski and Bettina Faltermeier for setting this up for Chris and I. I'll dive into the questions now!
Ed
Elvis Ratzlaff
Greenhorn
Joined: Feb 02, 2010
Posts: 1
posted
0
Tanks Ed Burns & Chris Schalk.
Ed Burns
author
Ranch Hand
Joined: Sep 11, 2006
Posts: 69
posted
0
Cor Takken wrote:
Is there to the knowledge of the authors one or a number of patterns which will help us reduce the number of these constructions or helping the developers limitting these constructions to the ones which will have the least risk of changing once the application is in production? My fear (backed by some experience) is that when once an application is in production the impact of maintenance is worsened by the presence of logic in the presentation layer.
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!
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!
This is very regrettable, but the procedures do leave room to ask questions in all sincerity to be asked in this topic. I would like to offer a suggestion to mention this in the first 'welcome'-message with, if possible, a link to the correct topic or to the page specifying how to create such a topic. I asked my question in the honest believe that this was the correct procedure and regret that my contribution will not be eligible. On the other hand, I am very grateful for the honest and insightful answer the author has given me.
Cor Takken wrote:This is very regrettable, but the procedures do leave room to ask questions in all sincerity to be asked in this topic. I would like to offer a suggestion to mention this in the first 'welcome'-message
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.
page specifying how to create such a topic.
Just click the New Topic button.
On the other hand, I am very grateful for the honest and insightful answer the author has given me.
Indeed. The book promotions on JavaRanch are very informative and useful.
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.
Let us say that it wasn't that apparant to me. If it was there, my apologies (my bad).
Just click the New Topic button.
My suggestion: add that to the bold text, just to avoid any mistakes or assumptions.
Indeed. The book promotions on JavaRanch are very informative and useful.
And we are thankful for that
Folkert Meeuw
Greenhorn
Joined: Nov 25, 2009
Posts: 21
posted
0
Nice to have you here. So, I can ask you about my use case with dynamic image loading in JSF.
Bill Johnston
Ranch Hand
Joined: Nov 17, 2005
Posts: 194
posted
0
Welcome, both of you. I just had a look at your book's contents, provided by the link in the opening post. I took a look @wiki under JavaServer Faces, the "what's new" with v2.0, as I had earlier done with the "what's new" in JEE v6. I confess that I am extremely new to Java web technologies, though not to the SDK SE - coming from a PL/SQL background for web technology. I like the idea of building a usable application, as your book apparently does.
~Bill
murthy vissapragada
Greenhorn
Joined: Mar 08, 2008
Posts: 2
posted
0
Hi Ed and Chris Welcome to Java Ranch
nice to see the authors of the book answering our questions