December 2011
2 posts
Difference between / and /* in servlet mapping
/ means the servlet is the default servlet for the app
/* is used for path mapping and captures all requests to the app. In essence, every request goes through this servlet even requests for JSPs. JSP cannot be used with a servlet mapping of /*
Never use /* in the servlet mapping.
This thread by far has the best explanation...
Scalate is good but not usable
Scalate is an awesome template engine and i really mean that. Its written in Scala and just fabulous in the way that it supports multiple template languages like HAML(Scaml),Jade and Mustache over a common interface.
Its simple enough to understand and is really easy to write HTML templates using Jade/Scaml without using an IDE. The documentation is decent enough to convince you to use it on your...
September 2011
5 posts
Test post from Android
2 tags
Escaping ID selector in jQuery
If you are using a framework like JSF/Struts which generates ids like
id=”form:myButton” or id=”form.myIput[1]” and want to use these ids in jQuery, it would complain “unrecognized expression :myButton”.
Escape it with double backslashes like this
$(“#form\\:myButton”) or $(“#form\\.myInput\\[1\\]”)
Deft - Tornodo like app server on the JVM →
REST Services in Scala using Akka →
I searched for quite a while to find this framework. Its built on top of Akka and its really straightforward to write services.
1 tag
Custom Username Password Parameter Names in Spring...
Spring Security 3 does not allow custom parameter names for username & password, if you are using using form based login. You have to use the default j_username and j_password. This may not be a problem for many use cases, but sometimes you would want to change that.
A feature request is in process by Spring Security community. If you dont want to wait till that’s done, here’s a...
May 2010
2 posts
CSS Selector for HTTPBuilder
If you use HTTPBuilder to crawl web pages and extract information, you would have noticed that it uses the Groovy’s XML Support for parsing HTML. Groovy’s GPath is powerful, but HTML has something more powerful (not to mention simple, easy and intuitive) for selection, CSS Selectors. jQuery has proved css selectors are indeed, the best way for DOM manipulation.
CSS Selectors are...
Facebook style input box using YUI2
A facebook style input box using YUI 2 Autocomplete. Demo here.
Download the code here.
April 2010
1 post
window.open behavior in Google Chrome
In Chrome,if window.open is called with same window name by pages which are managed by the same process, then the first call creates a new window and subsequent calls return reference to the existing window.If the pages are managed by different processes, then each call to window.open creates a new window.So far, i have been thinking
that if window.open is called with name of window which is...
July 2009
1 post
Fixed Header Table using jQuery
This is yet another jQuery plugin to provide fixed headers for tables. It differs in the way that it does not require any odd html table semantics. It just needs a TABLE tag with THEAD and TBODY to work its magic.
How it works?
Simple. It takes a TABLE, pulls the THEAD and TBODY out of it and puts them into two separate DIVs. Now, the DIV which THEAD (header-div) goes is overflow restricted....
June 2009
1 post
2 tags
Auditing using Interceptors in Hibernate
This would probably work only in Hibernate 3. Its loosely based on https://www.hibernate.org/48.html. I am showing a very basic example which sets the created time in a property when an entity is inserted and the updated time in another property when its updated.
Hibernate allows interceptors to be registered and calls it when an entity’s state changes during its lifecycle. Refer the...
April 2007
1 post
1 tag
Authoring Custom Namespaces in Spring 2.0
This post is a republish of the article I wrote for TheServerSide.com. You can find it here.
Starting from version 2.0, Spring supports XML Namespaces. The purpose of this article is to discuss the new XML schema based configuration available in Spring 2.0. Familiarity with previous versions of Spring and basic AOP terms is assumed. Spring now supports and recommends usage of XML Schema rather...