Learning Spring Faces, Security, Testing and Grail
Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.
JavaServer Faces (JSF) technology was created to solve this problem. It a server-side framework, which provides GUI components, manages their states from the server side, handles events, and etc. You can then develop a web app more like the standalone application in some sense. Because JSF manages the state from the server side, it uses more resources and less performant than it’s JS/AJAX equivalent.
Spring Faces is not a replacement for JSF, but complements in the “Spring” way. It facilitates deeper JSF and Web Flow integration, manages JSF components’ states, and provides more lightweight JSF components. Therefore, you can get leaner web application than using pure JSF.
Several tools can be handy for your debugging:
- Firebug. An add-on to the Firefox shown as below.
- YSlow. An add-on to Firebug
- Web Developer Firefox Add-on.
- Fiddler for IE
- IE Developer Toolbar
- Web Accessibility Toolbar for IE
- HTTP Monitor for Eclipse
I am sure there are many more useful tools. Which to use all depends on personal preferences and the maturity of the tools.
The above tools help to debug the Web application in a “black-box” way. If the Web app doesn’t even respond, you then have to go “white-box” way with tracing code with breakpoints and logs. No magic there, but a good understanding of the framework helps a lot.
There are many types of testing you can do with a Web app: unit testing, integration testing, end-to-end testing, performance/stress testing, and etc.
Again, many tools/frameworks can help here. The lab covers two of them:
- Selenium. It’s a great tool with three pieces: IDE, Core, and Remote Control. The IDE is essentially an add-on to Firefox. Once installed, it can record your clicks, types in the browser to test cases which can be saved with the Core. You can then type the URL to the TestRunner and get everything done in a browser as follows:
- Apache JMeter. It’s used for performance testing. Like Selenium, it also records your interaction with your Web app. To do that, you have to set up a proxy server in JMeter, and use the proxy from your browser.
Note: The URL pattern should be .* to include, and .*.css, .*.js, .*.png, .*.gif to exclude. Somehow the manual diagram missed the . and it just didn’t record anything.
Too much already, here is one more!
Groovy and Grail
Groovy is a script language built on top of JVM. It was invented by James Strachan and Bob McWhirter. BTW, as I read an article before, to become a famous software engineer, the number one shortcut is to invent a new programming language. After SpringSource merged G2One, it becomes the major driving force behind it.
Groovy has nice features like Closures, which has been tried but not added to Java yet. In my opinion, it’s a nice to have because you can achieve the similar with inner classes. It’s not worthwhile to increase the complexity of Java language with adding it. According to Joshua Bloch, Java as of 1.5 has used its budget of complexity.
Grail is a framework for building Web apps in Groovy. Why do you need yet another framework? Well, Grail is positioned as a RAPID framework and supposedly simplifies the Web app development. This simplification can well be the reason for you to jump into Grail camp.
For simplicity, there is a new alternative if you want to stick with Java. As I saw a demo last year at SpringOne 2GX, you can easily build full Java applications in minutes with the help of Roo.
Wait, is it something like Microsoft Visual Studio New Wizard that makes it super easy for creating simple projects but hard to modify when you need advanced features later on? Honestly, I haven’t tried it by myself yet so no opinion. You can try it out here.