Posts

Showing posts from April, 2011

Featured Post

Spring application Context and BeanFactory difference

I would like to give elaborated Idea on Spring ApplicationContext and BeanFactory BeanFactory BeanFactory can handle all Beans and gives instantiated Object as and when client requests . in this way BeanFactory Reduces the Burden BenaFactory calls customized bean Lifecycle clas Interfaces suchas InitializingBean and DisposableBean ApplicationContext - ApplicationContext is resolves All text messages by loading i18N Support - It supports generic way of loading Images - It Supports Event machanism for which listeners beans have been registered - BeanFactory Supprots Programatic way of loading mechanism but application Context supports declarative way of loading beans -ApplicationContext itself is resources loader for loading different resources and files - MessageResource is another interface which is used to load and resolve LocalizedMessages by implementing this interface and this is pluggable Spring Bean Inheritance Property Inheritance : This is to inherit the properties from...

JSF Portlet deployment descriptors

Guys , Today I am just going to explain about deployment descriptors that are used in JSFa nd Portal Integration in Jboss Portal Environment web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance " xmlns=" http://java.sun.com/xml/ns/javaee " xmlns:web= " http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd " xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd " id="WebApp_ID" version="2.5"> <display-name>PortalTest</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm...

Simple way to insert Elemnt at Mouse click Using JavaScript

Here is the code for inserting div element at Mouse Click in web page function test(e){ var d=document.createElement("div"); d.innerHTML="<img src=' http://static.springsource.org/spring/docs/2.0.x/images/admons/note.png '></img>"; d.style.display="block"; d.style.position="absolute"; d.style.left=(e.clientX+window.pageXOffset)+"px"; d.style.top=(e.clientY+window.pageYOffset)+"px"; d.display="block"; console.log(window); var b=document.getElementsByTagName("body"); b[0].appendChild(d); } document.onclick=test; This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/...

Hibernate Sample Ex

import java.io.InputStream; import java.util.Properties; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; /** * @author Venkata Sitaram P - sitaram.pv * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class ConfigurationEx { public static void main( String[] args ) { try{ SessionFactory sf = null; //sf = configureUsingHibernateConfigPropertiesFile(); //sf = configureUsingProperty(); //sf = configureUsingHibernateCfg(); //sf = configureUsingPropertiesFile(); sf = configureUsingOtherCfgFileName(); sf.getCurrentSession().beginTransaction(); System.out.println( "Session Factor ::" + sf.getCurrentSession().connection().getTransactionIsolation() ); } catch( Exception e ){ e.printStackTrace(); } } private static ...

Hibernate Component Mapping

Page 1 of 8 Hibernate Tutorial 07 Component Mapping 1. Using a component In our online bookshop application, a customer can place an order for purchasing some books. Our staff will process his order and deliver the books to him. The customer can specify different recipients and contact details for different day periods (weekdays and holidays). First, we add a new persistent class Order to our application. public class Order { private Long id; private Book book; private Customer customer; private String weekdayRecipient; private String weekdayPhone; private String weekdayAddress; private String holidayRecipient; private String holidayPhone; private String holidayAddress; // Getters and Setters } Then we create a mapping definition for this persistent class. We just map the properties of this class as usual. <hibernate-mapping package="com.metaarchit.bookshop"> <class name="Order" table="BOOK_ORDER"> <id name=...

Hibernate Inheritance and polymorphism

Page 1 of 4 Hibernate Tutorial 08 Inheritance Mapping 1. Inheritance and polymorphism Suppose that our bookshop is also selling CDs and DVDs to our customers. We first create a class Disc and provide a mapping definition for it. public class Disc { private Long id; private String name; private Integer price; // Getters and Setters } <hibernate-mapping package="com.metaarchit.bookshop"> <class name="Disc" table="DISC"> <id name="id" type="long" column="ID"> <generator class="native"/> </id> <property name="name" type="string" column="NAME" /> <property name="price" type="int" column="PRICE" /> </class> </hibernate-mapping> 1.1. Inheritance There are mainly two kinds of discs we are selling, audio discs and video discs. Each kind has different properties from the other. From the orie...

Hibernate One To Many Association

Page 1 of 9 Hibernate Tutorial 06 One-to-many and Many-to-many Association 1. One-to-many association In the previous example, we treat each chapter of a book as a string and store it in a collection. Now we extend this example by making each chapter of a persistent object type. For one book object can relate to many chapter objects, we call the association from book to chapter a "one-to-many" association. We will first define this association as "unidirectional", i.e. navigable from book to chapter only, and then extend it to be "bi-directional". Remember that we have a Chapter class in our application that hasn't mapped to the database. We first create a Hibernate mapping for it and then define an auto-generated identifier. This generated identifier is efficient for associating objects. public class Chapter { private Long id; private int index; private String title; private int numOfPages; // Getters and Setters } <hiber...

SCWCD Exam Material

M A N N I N G Hanumant Deshmukh Jignesh Malavia Matthew Scarpino SCWCD EXAM STUDY KIT SECOND EDITION JAVA WEB COMPONENT DEVELOPER CERTIFICATION SCE 310-081 Praise for the First Edition "Written in a very easy-to-read, conversational tone and is an excellent resource for someone who's familiar with Java but not with Servlets and JSPs or even for someone familiar with them, but who needs to brush up on some of the details for the exam … The bundled CD is chock-full of excellent resources … I will definitely use this book as a resource even after the exam." — JavaRanch.com "If you want to buy just one book for the SCWCD exam, then this is the book to buy. The book is well-written and should act as a good reference for you." — JavaPrepare.com "An excellent study guide highly recommended not only for SCWCD exam takers, but for anyone intending to put their exam credentials to good use … a solid reference for dedicated programmers....