3

We have a large - and quite old - project using JSF 1.1 (specifically the MyFaces implementation) with JSP as view technology. Right now we want to upgrade the used JSF version, view technology and taglibs in use. Migrating from JSF 1.2 to JSF 2.0 gave some idea of the woes we are likely to encounter.

I am new to JSF but I do understand that Facelets are only supported since JSF 2.x, so we need to update the JSF version before we can begin replacing JSPs with Facelets.

Currenty, we also use some old taglibs like Ajax4JSF and an old version of RichFaces, that - IIRC - is based on Ajax4JSF and of which one main feature is also to provide Ajax functionality and Ajax-enabled components to JSF. If I got this right, JSF 2.x supports Ajax functionality natively and therefor taglibs like Ajax2JSF aren't really needed anymore.

Since it seems that RichFaces' "life cycle" has finished last year (according to wikipedia), this also seems to be a good opportunity to also replace RichFaces with PrimeFaces, which seems to be still in active development and gets recommended quite often. I am not sure, though, if this replacement makes sense or if these two component libraries even offer similar components or if they aim two provide two totally different sets of components and this replacement is a bad idea to begin with.

One way or the other, I'd like to know in which order these 3 steps would make the most sense. Since Facelets require JSF 2.x and current versions of modern taglibs also only seem to work with new JSF versions, I assume updating JSF has to be done first, but concerning the replacement of JSPs with Facelets and of RichFaces/Ajax4JSF with PrimeFaces, in which order should these two be done?

My guess is that current taglibs might also depend on Facelets so perhaps this order makes the most sense?

  1. JSF 1.1 => JSF 2.x
  2. JSP => Facelets
  3. RichFaces => PrimeFaces
Community
  • 1
  • 1
scholt
  • 147
  • 2
  • 16
  • I've faced a similiar question, moving from JSP to JSF, but my solution was to re-right every thing since there is a gap between JSP and JSF i am afread to tell you that you are in a worst case – Yagami Light Mar 29 '17 at 12:52
  • Sorry for being pessimistic but you are facing a real challenge (it for sure depend on the size of your application) – Yagami Light Mar 29 '17 at 12:53
  • @YagamiLight thanks for your comment. I do understand that there is no such thing as upgrading JSP to JSF, since JSP is just the old default template engine/view technology of JSF, so it would rather be "upgrading from JSP to Facelets" (which I mentioned as the second point above), but my main point is that I don't necessary need to update everything at once. I would be perfectly happy with just updating JSF from 1.1 to 2.x first and keep the JSP templates for the time being. Then, once everything runs with JSF 2 I could concentrate on replacing the JSPs with Facelets. – scholt Mar 29 '17 at 12:59
  • it's totally true ( read this post to have a better look to [What is the difference between JSF, Servlet and JSP?](http://stackoverflow.com/questions/2095397/what-is-the-difference-between-jsf-servlet-and-jsp), if you ask for my opinion if the decision is your's upgrading from SF from 1.1 to 2.x is a good step but somethimes (and it was my case) it's not your decision – Yagami Light Mar 29 '17 at 13:03
  • for example in my office moving from JSP to JSF was a stratigical decision ( the main reason was the java code that you can right in the JSP page and the name's of the managedBean) – Yagami Light Mar 29 '17 at 13:05
  • please @BalusC help us with your knowledge – Yagami Light Mar 29 '17 at 13:08
  • 1
    @YagamiLight yes, thanks, I already read http://stackoverflow.com/questions/2095397/what-is-the-difference-between-jsf-servlet-and-jsp and it was very englightening - like most of the posts by BalusC. As mentioned, I also read http://stackoverflow.com/questions/4441713/migrating-from-jsf-1-2-to-jsf-2-0 which gave me the impression that _just_ updating the JSF version from JSF 1.x to JSF 2.x while still keeping JSP wouldn't be so hard and a good point to start such an upgrade progress. – scholt Mar 29 '17 at 13:10
  • This is very sad, but I agree fully with @YagamiLight. If your application uses advance methods and techniques, the cost of "moving" this code will be to great. Only moving from RichFaces to PrimeFaces is a challange, because PF is bigger (better?), but far less elastic. So you will have to learn the PrimeFaces way of doing things. – Emil Sierżęga Mar 29 '17 at 14:47
  • BTW. Calling out any SO user is pretty lame. Seriously. If someone wants to help, he/she will. Would you write to Messi, because you want to learn to play football? – Emil Sierżęga Mar 29 '17 at 14:51
  • Calling for help is better than staying in the dark guessing and giving some self opinion solution. The real shame is to be ashamed about asking for knowledge – Yagami Light Mar 30 '17 at 07:41
  • @EmilSierżęga thanks for your answer. The final decision on the switch from RichFaces to PrimeFaces has not yet been made, but since the whole refactoring of our project is planned to take over a year, I hope we will have enough time to update our taglibs as well. (We are not using _that_ much stuff from RichFaces and Ajax4JSF to begin with) In any case, I would still love to hear your opinion whether such a taglib migration should be done before or after replacing JSP with Facelets. – scholt Mar 30 '17 at 11:52

1 Answers1

0

To answer my own question: After working on this upgrade for some time and running into a few dead ends, for me the following order of steps has turned out best:

  1. Upgrade JSF implementation (in my case: from MyFaces 1.1 to MyFaces 2.2.12)
  2. Replace JSP files with Facelets and comment out all occurences of tags from unsupported tag libraries (some functionality will be lost until the migration is completed, but this way I have to migrate those taglibs just once - to use them in Facelets - and not twice (once for use in JSPs with JSF 2, and then for use in Facelets))
  3. Replace and update unsupported and outdated tag libs
scholt
  • 147
  • 2
  • 16