Thursday, April 2, 2009

    Custom Error Pages

    Nope you are wrong, I am not talking about errorPage="true" attribute in this blog. I am talking about few error messages which are sent by the server to the browser like 404. How often you have seen this page.
    Now this is not a good way to treat your site visitors. The main problem with this kind of errors is that than the visitors can drift away from your site. So displaying a custom error message with features like navigation to similar pages or asking them to report a broken link is far better. You can do that pretty easily using the below mentioned solution.

    Implement custom error pages to hide raw exception messages. To do this, simply add something like the following to your web.xml:

    <error-page>
    <error-code>404</error-code>
    <location>/error/404.html</location>
    </error-page>




    Now you are free to write your own custom messages in the 404.html file

    Here is something which is out of scope for this article but you may find interesting. Here are reference to some of the best 404 pages on the web. Best 404 Pages

    Monday, February 9, 2009

    Add bubbles to YUI

    YUI has been a great tool to create fast RUI web applications. Intermediates, who are already using it, are complaining about important missing pieces. And experts are comparing it with other such libraries like DOJO, Script.Aculo.Us etc.

    Few of the most important features which are missing in YUI are expandable/collapsible panel. Accordion Menu etc. There exists a library which spices up few things for YUI named bubbling library. It does not provide solutions to all YUI problems but it does provides some interesting widgets which can be plugged with existing YUI controls to provide some respite for the developers. 

    The current version of bubbling library available is 2.0 which supports YUI 1.6.0 build. Earlier version can be used with YUI 1.5.2 build as well.

    Site has got great documentation and the download size is really sleek with only 206 KB. Whether you choose to use it or not but I will recommend one visit to the example section of the site.

    Cheers


    Monday, June 2, 2008

    Cobertura - Test Coverage Tool

    Many a times we wonder that why a software failed even when we have got everything insured with unit tests. Or some times the situation are when we are not exactly sure why the software is not working the way we want it too even though all the tests are passed. If you have gone through similar situations and looking for an answer, this is it.


    Cobertura is a versatile Java unit test coverage (This blog is about J2EE right) tool. It is a profilic tool that calculates line by line coverage and branch coverage along side other useful metrics like McCabe Complexity Number etc. But the most important idea is that you can see whether your tests are executing your code at each line or not. This becomes very important at the time when you are debugging the unknown error or securing your code for future moderation sensitivity. In any case nothing better than a FREE TOOL. Yes you heard me right its Free. You can download the same from here http://cobertura.sourceforge.net/. If you find any dificullty in installing the same for your project, feel free to write to me.


    If you are an advance user and already knows about cobertura than there are chances that you probably might also knows about Clover (Paid Tool Not Good ) http://www.atlassian.com/software/clover. Price is very high but the dashboard they provide is execellent.


    So don't be disappointed if you cannot purchase the same, as in the near future I will be updating my own xsl sheet which can generate similar report for you without fuss. And yes that will be absolutely FREE, you can donate some bugs for my beer if you wish. But that xsl is free no questions asked :)


    By the way, this is what Cobertura reports looks like this:


    While my xsl will process the output and provide a report like this:


     

    Site Info

    Text

    Java 2 Enterprise Edition Copyright © 2009 Community is Designed by Bie