Author Archives: hongliangli

Create customised auto-complete

$(document).ready(function() { $(“#apex-owner-autocomplete”).keyup(function() { var term = $(‘#apex-owner-autocomplete’).val(); if (term.length > 2) { $.ajax({ //the servlet address to get json data url: “<c:url value=”/ajax/apex-parent-name.htm”/>”, dataType: “json”, data: { //parameters that need to forward with the url name_startsWith: term, filterName:”PARENT_NAME” }, … Continue reading

Posted in Javascript | Leave a comment

More about Criteria

  In the earlier note, I have compared the using named query and criteria in general. In this note, I will talk a bit more about the criteria, as I have realised one major advantage of criteria that was not … Continue reading

Posted in Hibernate | Leave a comment

Create PDF file with custom open actions

This article will illustrate how to dynamically generate a PDF file, which will have the print dialog box automatically popped up when the file is opened in your web application. public ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {    //if … Continue reading

Posted in Dynamic File Generation | Leave a comment

Anotation Basic Use 3

Annotation-based controller configuration Spring 2.5 introduces further stereotype annotations: @Component, @Service and @Controller. @Component serves as a generic stereotype for any Spring-managed component; whereas, @Repository, @Service, and @Controller serve as specializations of @Component for more specific use cases (e.g., in … Continue reading

Posted in Spring | 2 Comments

A Completed Example for Hibernate

A Completed Example for Hibernate In the following example, I am trying to create a new trial user and create a default subscription for it based on Hibernate lazy initialisation. In the first part, I would like to HibernateTransactionManager to … Continue reading

Posted in Hibernate | 1 Comment

Using XML XSL transformation in depth

Using XML XSL transformation in depth It is very convenient to transform an XML source file to a HTML page using XSL style sheet via JSTL x: tag. <x:transform doc="${XML}" xslt="${XSL}">   However, in some occasion, you might want to … Continue reading

Posted in XML | 2 Comments

Spring Data Access Support

Consistent abstract classes for DAO support To make it easier to work with a variety of data access technologies such as JDBC, JDO and Hibernate in a consistent way, Spring provides a set of abstract DAO classes that one can … Continue reading

Posted in Spring | 1 Comment