Cry or laugh?
There's another Java related website at roseindia.net which hosts lot of basic Java EE tutorials along a huge mass of advertisements. There are also some JSF tutorials over there. Since I saw that site for the first time, about 1.5 years ago, I quickly realized that almost every article and code sample at that site must be taken with a huge bag of salt. But OK, I thought, that kind of websites unfortunately exist, nothing to do against, so I ignored it for the rest of the time.
And today, while surfing over the net I accidently came across http://www.roseindia.net/jsf/actionListener.shtml (screenshot). Now I don't know whether I have to cry or laugh about it. Initially I laughed hard, very hard. Running a Swing JOptionPane component from inside a server side Java class with the intention to display a message at the client side!! And showing that off as a tutorial?!? But then I realized that there might be many new-to-JSF developers who came across the roseindia.net site and took the gross of the articles for serious and implemented it for production. Ouch, that hurts! Also see the comments at the bottom of that article.
Update: here and here are another examples of a horror story related to roseindia.net. A poor programmer decided to implement the JSP file upload example as described at http://www.roseindia.net/jsp/file_upload/Sinle_upload.xhtml.shtml (ouch, note the typo and double extensions in the roseindia.net URL, how professional). The code example is bad in almost every way. The HTML code contains nasty uppercases (the author is apparently hanging in the '90s HTML style). The HTML code contains the <center> tag which is deprecated since 1998 (yes, that is 10 years ago!! the same applies on the <font> tag which appears everywhere in roseindia.net's HTML source, how professional). The Java code is written entirely in a JSP file rather than a Java class (scriptlets are receipt for trouble). The uploaded file is allocated completely in memory instead of in a memory buffer (server will crash if the file or all files together are larger than JVM's available memory). The bytes are unnecessarily converted to String without respect to request encoding and using the system default encoding (ouch, what would happen with binary files? and with text files in another encoding?). Also read the comments at that article. Heck, almost every article has that kind of comments, shouldn't that already say something about the quality of the articles? See further also this stackoverflow.com answer.
Update 2: another horror story can be found here. One decided to download and install JSTL using the procedure as described at http://www.roseindia.net/jstl/downloading-jstl.shtml. Did you read it? It suggests to extract the complete JAR file, duplicate all of its TLD files in the WEB-INF and duplicate all of the TLD declarations in the web.xml of every webapplication which is going to use JSTL. Terrible. Just placing the JAR files in the classpath was been enough. The myth of extracting the JAR file is only applicable if you have downloaded the wrong JSTL version for your webapp which causes that EL (those ${}
things) in JSTL tags may possibly fail. For more detail of the proper approach, read JSTL wiki page on stackoverflow.com.
Lesson learned: if you are new to Java EE, do not use roseindia.net! It might contain some good articles -which are generally copypasted/rephrased/changed from actually good sources (I've seen exact copypastes of parts of official TLD and API documentations, e.g. Tomahawk TLD and Java Servlet API, how lame..), or are in very rare cases just by coincidence good-, but for the rest it only introduces bad practices and/or contains stupid examples. That site almost seems to be maintained by amateurs with zero professional experience and targeted on the advertisement incomes only. If you are new, you never knows which is good and which is bad. So, just ignore that site. Forever.
Good JSF sites
At least here is a list of trusted and good JSF related sites:
- JSF 2.3 specification document explains why JSF is there, how it works and what it all provides.
- JSF 2.3 API documentation contains detailed javadocs of the JSF API classes, it explains where the classes are for, how to use them and what all fields/methods do.
- JSF 2.3 tag library documentation shows which JSF tags are all available, what they all do and which attributes they supports.
- Oracle Java EE 7 tutorial part III chapter 7 and on contains Oracles's own JSF 2.3 tutorial.
- JSF by Bauke Scholtz my link collection of best resources on JSF.
- If you want to get a book, I highly recommend the Mastering JSF 2.2
And, of course, the JSF related articles at this blog. Check them out at the 'Tags' or 'Articles' section in the right column. The JSF wiki page at stackoverflow.com is also a nice starting point.