Skip to content

Instantly share code, notes, and snippets.

View jeevan-patil's full-sized avatar
🎯
Focusing

Jeevan Patil jeevan-patil

🎯
Focusing
View GitHub Profile
@jeevan-patil
jeevan-patil / servlet-context.xml
Last active December 17, 2015 10:49
Spring application context xml file.
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
@jeevan-patil
jeevan-patil / CustomerController.java
Created May 17, 2013 06:38
Sample spring controller using annotations.
package com.transbank.online.controller.customer;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@jeevan-patil
jeevan-patil / CustomerServiceImpl.java
Created May 17, 2013 06:44
sample Spring service class
package com.transbank.online.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.transbank.online.bean.Customer;
import com.transbank.online.dao.iface.CustomerDao;
import com.transbank.online.service.iface.CustomerService;
@jeevan-patil
jeevan-patil / CustomerDaoImpl.java
Created May 17, 2013 06:46
Sample Spring DAO repository class.
package com.transbank.online.dao.impl;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import com.transbank.online.bean.Customer;
import com.transbank.online.dao.iface.CustomerDao;
@jeevan-patil
jeevan-patil / app-context.xml
Created May 17, 2013 06:56
Interceptor to add cache headers in http response.
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
@jeevan-patil
jeevan-patil / cache-headers.jsp
Created May 17, 2013 06:59
Meta tags used in JSP files to add cache headers.
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
@jeevan-patil
jeevan-patil / SetImpl
Last active August 29, 2015 13:56
Demonstrate how to add elements to Set.
package org.java.collections;
import java.util.HashSet;
import java.util.Set;
/**
*
* @author jeevan
* @date 15-Feb-2014
* @purpose Demonstrate how to add elements to Set.
@jeevan-patil
jeevan-patil / HashSet
Created February 15, 2014 13:10
Implementation of add method in java HashSet.
public class HashSet<E>
extends AbstractSet<E>
implements Set<E>, Cloneable, java.io.Serializable
{
private transient HashMap<E,Object> map;
// Dummy value to associate with an Object in the backing Map
private static final Object PRESENT = new Object();
@jeevan-patil
jeevan-patil / HashMapAdd
Last active August 29, 2015 13:56
HashMap add method
public class HashMap<K,V>
extends AbstractMap<K,V>
implements Map<K,V>, Cloneable, Serializable
{
public V put(K key, V value) {
if(key is already present in map) {
return oldValue;
}
<form:form id="personForm">
<form:input path="name" />
<input type="submit" value="Submit">
</form:form>