Recent Posting By Author

By Author :

How To Install Java, Install java in windows

Let us see this basic tutorial, how to install java in your system.. Setp1:- Download JDK 1.6 from www.oracle.com / any sharing sites,…

Hibernate Hello World Program (Hibernate Insert Query)

Mates, here is the first program in hibernate like saving an object into the database (don’t think we are inserting a record into the database 🙂 that is the case in JDBC, in hibernate we are just saving an object…

Hibernate Hello World Program in Eclipse

Mates, now am going to show like how to execute the previous hibernate program in Eclipse IDE to make our world little easy. You might be fresher or not aware of executing java programs in the eclipse what ever…

Example On Hibernate Select Query

This is an example for loading the object from the database remember in the hibernate loading 1 object from the database means applying select command (select * from _____) for fetching one complete record from the database. Files required…

Example On Hibernate Delete Query

This is the program to Delete a row (Object) from the database, just like using delete query in the jdbc program.. Files required to execute this program.. Product.java (My POJO class) Product.hbm.xml (Xml mapping file ) hibernate.cfg.xml (Xml configuration…

Example On Hibernate Update Query

This is the program to update an object (1 complete row) in the database, which is already persisted in the database, then we have the following two approaches… Approach 1 Load that object from the database, and modify its…

Hibernate Versioning Example, Hibernate Versioning Of Objects

Once an object is saved in a database, we can modify that object any number of times right, If we want to know how many no of times that an object is modified then we need to apply this…

Importance Of Wrapper And Primitive Types In Hibernate

Now we are going to see the main advantages of wrapper types over primitives in the hibernates, will see with an example Files required to execute this program.. Product.java (My POJO class) Product.hbm.xml  (Xml mapping file ) hibernate.cfg.xml  (Xml…

Hibernate Lifecycle Of pojo Class Objects

Actually our POJO class object having 3 states like… Transient state Persistent state Detached state   Transient & Persistent states: When ever an object of a pojo class is created then it will be in the Transient state When…

Hibernate Converting Object From Detached to Persistent state

Now we will see, how to convert the detached state object into Persistent state again…, As usual hibernate configuration, mapping XML are same and pojo class too, if you want just refer Hello World Program ClientLogicProgram.java: import org.hibernate.*; import…

Inheritance Mapping In Hibernate – Introduction

Compared to JDBC we have one main advantage in hibernate, which is hibernate inheritance.  Suppose if we have base and derived classes, now if we save derived(sub) class object, base class object will also be stored into the database….

Hibernate Inheritance: Table Per Class Hierarchy

Here is the explanation and one example on hibernate table per class hierarchy, consider we have base class named Payment and 2 derived classes like CreditCard, Cheque If we save the derived class object like CreditCard or Cheque then…

Hibernate Inheritance: Table Per subClass Hierarchy

This is also just like previous example, but some changes are there, in table per class hierarchy all the data was saved in a single table but here, x number of classes = x number of tables in the…

Hibernate Inheritance: Table Per Concrete Class Hierarchy

Something like previous example but the changes are at mapping file only, and one more thing is.. x number of derived classes = x number of tables in the database Once we save the derived class object, then derived…

Example On Composite Primary Keys In Hibernate

Composite primary keys means having more than one primary key, let us see few points on this concept If the table has a primary key then in the hibernate mapping file we need to configure that column by using…

Composite Primary Key In Hibernate With Select Query

Composite primary keys means having more than one primary key right..? Example On this__ Files required…. Product.java (Pojo) ForOurLogic4Load.java (for our logic) hibernate.cfg.xml Product.hbm.xml All files are same like previous program, but ForOurLogic4Load.java is the new file for loading…

Generators <generator> In Hibernate

<generator /> is one of main element we are using in the hibernate framework ,  let us see the concept behind this generators.   Up to now in our hibernate mapping file, we used to write…

Part 1 Hibernate Query Language Introduction

So far we done the operations on single object (single row), here we will see modifications, updates on multiple rows of data (multiple objects) at a time.  In hibernate we can perform the operations on a single row (or)…

Part 2 Hibernate Query Language, Executing HQL Commands

Let us see, how to execute HQL commands.. Procedure To Execute HQL Command: If we want to execute execute an HQL query on a database, we need to create a query object ” Query ” is an interface given…

Part 3 HQL, Different Ways Of Executing HQL Commands

We can execute our HQL command in 3 ways,  like by selecting total object, partial object (more than one column), partial object (with single column).  Let us see..   Different Ways Of Executing HQL Case 1: [ Selecting Complete…

Part 4 Hibernate Query Language, Using HQL Select Query

Let us see the program on HQL select command,  which is going to cover complete object, partial object (More than one column), partial object (Single column) here are the required files…. Product.java (POJO class) Product.hbm.xml  (Xml mapping file )…

Part 5 Hibernate Query Language, Passing Runtime Values

Now we will see, how to pass the values at time time while using the HQL  select query, actually same concept for 3 cases. Required files… Product.java (POJO class) Product.hbm.xml  (Xml mapping file ) hibernate.cfg.xml  (Xml configuration file) ForOurLogic.java…

Part 6 Hibernate Query Language, HQL Update,Delete Queries

so far we have been executed the programs on Hibernate Query Language (HQL) select only, now we will see the DML operations in HQL like insert, delete, update., you know some thing..? this delete, update query’s are something similar…

Part 7 Hibernate Query Language Insert Query

Now we will see how to use HQL insert query, as i told earlier its little different then remaining query’s, actually the thing is….. HQL supports only the INSERT INTO……… SELECT……… ; there is no chance to write INSERT…

Criteria Query, Hibernate Criteria Query Introduction

Unlike HQL, Criteria is only for selecting the data from the database, that to we can select complete objects only not partial objects, in fact by combining criteria and projections concept we can select partial objects too we will…

Example On Hibernate Criteria Query

Let us see an example program on hibernate criteria query, files required…. Product.java(POJO class) Product.hbm.xml hibernate.cfg.xml ForOurLogic.java (For writing our business logic) Product.java package str; public class Product{ private int productId; private String proName; private double price; public void…

Hibernate Criteria, Adding Conditions To Criteria

If we want to add some sorting order for the objects, before the objects are going to store in list object then we need to add an Order class object to the Criteria class object by calling addOrder() method..,…

Hibernate Projections Introduction

So far in criteria, we are able to load complete object right….! let us see how to load the partial objects while working with criteria.  The projections concept is introduced in hibernate 3.0 and mainly we can do the…

Hibernate Projections, Example On Hibernate Projections

Now we will see how to use this criteria to select partial objects from the database with the help of projections, (Remember, We cant select partial objects in criteria with out projections support) files required… Product.java(POJO class) Product.hbm.xml hibernate.cfg.xml…

Example On Hibernate Criteria With Multiple Projections

If we want to load partial object, with multiple columns using criteria then we need to create the ProjectionList with the multiple properties and then we need to add that ProjectionList to the criteria files required… Product.java(POJO class) Product.hbm.xml…

Difference between HQL and Criteria Query in Hibernate

Let us see the main differences between HQL and Criteria Query HQL is to perform both select and non-select operations on the data,  but Criteria is only for selecting the data, we cannot perform non-select operations using criteria HQL…

Hibernate Native SQL Query Example

Native SQL is another technique of performing bulk operations on the data using hibernate By using Native SQL, we can perform both select, non-select operations on the data In face Native SQL means using the direct SQL command specific to…

Hibernate Named Query Introduction Tutorial

Let us see few points, before going to see an example on Named Queries in HIbernate.. While executing either HQL, NativeSQL Queries if we want to execute the same queries for multiple times and in more than one client…

Hibernate Named Query Example

Let us see an example on Hibernate Named Queries, files required… Product.java(POJO class) Product.hbm.xml hibernate.cfg.xml ForOurLogic.java (For writing our business logic)   Product.java package str; public class Product{ private int productId; private String proName; private double price; public void…

Hibernate In Servlet Example, Hibernate In Servlet Tutorial

With servlet, if we want to do some operations on the database, then we can also use hibernate ORM rather than JDBC.  We call this as servlet-Hibernate integration. While integration servelt with hibernate, it is there to follow these…

Example On Hibernate Pagination With Servlet In Eclipse

Let us see an example on hibernate pagination with servlet.. when response for request is too large then instead of displaying all records at a time on browser  we can…

Hibernate Relationships In Depth

Using hibernate, if we want to put relationship between two entities , then in the database tables, there must exist foreign key relationship, we call it as Referential integrity. The main advantage of…

Hibernate One to Many Mapping Insert Query Example

One-to-Many:  according to database terminology, one row of table related with multiple rows of other table According to hibernate, one object of one pojo class related to multiple objects of other pojo I mean, one to many…

Hibernate One to Many Mapping Delete Query Example

Let us see the logic for hibernate one to many mapping delete query, Actually every thing is same like Hibernate One-to-Many Mapping Insert  but only change is in OurLogic.java file. But mates, ensure you came through these sessions for…

Hibernate One to Many Select Query Example

Let us see the logic for hibernate one to many mapping select query, hibernate one to many select means, if you select the parent object then automatically its corresponding child objects will also be selected, see i have given…

Hibernate Many to One Mapping Insert Query Example

Let us see how to achieve hibernate many to one mapping with insert query, just go through few points before we start the example In the many to one relationship, the relationship is applied from child object to parent…

Hibernate Many to One Mapping Select Query Example

In many to one relationship, when ever child object is loaded from the database then automatically the parent object will also be loaded from the database. Let us an example on selecting single child object with its parent object….

Hibernate Many to One Mapping Delete Query Example

Let us see the example on hibernate many to one delete query… If we delete child, parent will not deleted because, it may have lot of other child objects In many to one relationship, when ever a child object…

Hibernate One To Many Bidirectional Mapping Example

Let us see how to achieve, Bidirectional one to many  mapping in hibernate… Actually in normal one to many, the relation is from parent to child i mean if we do the operations on parent object will be automatically…

Hibernate Many to Many Mapping Example

Let us see an example on this many to many relationship in hibernate.  Actually here there is no question of unidirectional, only Bi-Directional. Applying many to many relationship between two pojo class objects is nothing but applying one to…

Hibernate One to One Mapping Example

Let us see few points regarding this one to one mapping.. One object is associated with one object only In this relationship, one object of the one pojo class contains association with one object of the another pojo class…

Hibernate Cascade Options – Cascade Attribute In Hibernate

Cascade Attribute In Hibernate Main concept of hibernate relations is to getting the relation between parent and child class objects Cascade attribute is mandatory, when ever we apply relationship between objects, cascade attribute transfers operations done on one object…

What Is Spring Framework, Spring Introduction

Let us see what is Spring Framework, and why we need to work with this Spring… Spring is a light weight and open source framework created by Rod Johnson in 2003. Spring is a complete and a modular framework,…

Spring Modules, What Are Spring Modules

Actually in spring 1.x, the framework has divided into 7 well defined modules.  But in 2.x framework is divided into 6 modules only.. Spring Core Module Spring Context Spring DAO Module Spring…

Spring Core Module, Spring IOC Tutorial

Core Module is the heart of Spring,  tight coupling and loose coupling is the heart concept of Core Module 🙂  so let us try to understand about tight and loose coupling between java objects in spring [ you can’t…

Dependency Injection In Spring Framework

Guys, its very important concept in spring read it carefully Dependency injection: In this IOC, consider when our class object need to get any primitive values or it need  to access any other class objects or it may need …

Spring Framework Installation

Before we are going to see the example on setter injection with primitive, let us see how to install spring framework in your system. Few Points regarding this.. Working with a frame work software is nothing but working with…

Quick Steps To Developing Spring Applications – Don’t Miss

We will see the steps to be follow for developing any spring application, these are core level read carefully. Spring environment starts by loading spring configuration xml file into Resource Interface object, we call this loading process as bootstrapping…

Spring Hello World, Setter Injection With Primitive Values

Let us see the first program in spring, which is going to be the setter injection with some primitive values… Files required.. WelcomeBean.java ClientLogic.java spconfig.xml [ spring configuration file, it can be of any name…

Setter Injection With Objects, Spring Dependency In The Form Of Objects

In previous example, we have seen that our spring bean class object depends on the string primitive, and now will see what if our class is depends on other class object, i mean dependency in the form of object….

Example On Spring Dependency In The Form Of Objects

Let us see one example for previous concept, dependency in the form of objects with <ref /> element files required.. i am taking complete pojo / poji model this time, And mates this is  ” very important and Exact…

Spring Setter Injection, Dependency In The Form Of Collections

While creating spring bean (pojo class), the bean class can use any of the following 4 types of collections as dependency, along with some primitives and objects like previous sessions.. Set List Map Properties Spring supports these 4 collections…

Spring Dependency Injection With Set Collection Property

Let us see few points, if we have Set property in our program If in our spring bean has a property of type Set then in the spring config xml file, we need to use <set> element to inform…

Spring Dependency Injection With List Collection Property

This is same as <set />, right previous session, but few changes are there, let us see the difference between these two <set /> and <list /> In the previous example [ Dependency In The Form Of Set Collection Property…

Spring Dependency Injection With Map Collection Property

Map will stores the data in key, value base that to key, value must be the objects of any type.  One is called one pair or one entry. k1 Oracle k2 Sun k3 Java4s k4…

Joins In Hibernate

Let us see few points regarding this hibernate joins…., like why and where we need to us bla bla We use join statements, to select the data from multiple tables of the database, when there exist relationship with joins,…

Hibernate Left Join, Hibernate Left Join Example

Left join means, the objects from both sides of the join are selected and more objects  from left side are selected, even though no equal objects are there at right side, no confusion you will be able to understand…

Hibernate Caching Mechanism, Hibernate Cache

Every fresh session having its own cache memory, Caching is a mechanism for storing the loaded objects into a cache memory.  The advantage of cache mechanism is, whenever again we want to load the same object from the database…

Hibernate First Level Cache Example

Let us try to understand the first level cache in hibernate,  actually i tried to give almost all the concept about this first level cache hope you will enjoy this 🙂 By default, for each hibernate application, the first…

Ajax First Program With Explanation

Let us see first ajax program..,  so that i can explain the inner concepts practically 🙂 Files used… Firstprogram.html java4s.txt <html> <head> <script type=”text/javascript”> function fun1() { var a; if (window.XMLHttpRequest) {// If the browser if IE7+FirefoxChromeOperaSafari a=new XMLHttpRequest();…

Constructor Injection In Spring [ Full Concept ]

In this type of injection spring container uses constructor of the bean class for assigning the dependencies. In spring config xml, we need to inform to the spring IOC container about constructor injection by using <constructor –arg /> In…

Difference between Setter Injection and Constructor Injection

Up to now we came through the concept about setter injection and constructor injection with dependencies right, now let us see the difference between setter and constructor injection…   Setter Injection Constructor Injection 1. In Setter Injection, partial injection…

Why Struts 2, Introduction To Struts Framework

Let us see the quick and brief introduction to struts 2 framework, struts is an open source framework given by Apache software foundation under one of its projects called Jakarta.  Struts is the frame work, used to develop web…

Struts 1.x vs Struts 2.x Main Differences

Let us see the component and functional differences between struts 1.x and struts 2.x  In struts 1.x front controller is ActionServlet In 2.x front controller is FilterDispatcher In struts 1.x we have RequestProcessor class In 2.x we have Interceptors…

How To Enable Second Level Caching In Hibernate

First level cache will be enabled by default, but for enable second level cache we need to follow some settings, let us see few points regarding this..   Second level cache was introduced in hibernate 3.0 When ever we…

Hibernate Second Level Cache Example

Let us see the example on this hibernate second level cache.  please go through the concept on this second level cache, still if you have any doubt Files required…. Product.java  ForOurLogic.java Product.hbm.xml…

Ajax Request, open() and send() methods

In Ajax if we want to send the request to the server,  we have 2 methods in XMLHttpRequest object to do this work,  those are open() and send(). Actually open() method will opens the connection with the server and…

Ajax Server Response, responseText and responseXML

Once we send the request to the destination , we will get the response from the server in two formats either in Text or XML, i mean we can get the response from the server by using…

Hibernate Annotations Introduction

Gun short point :-  Annotations are replacement for XML Let us see few points regarding annotations in hibernate Annotations are introduced in java along with JDK 1.5, annotations are used to provide META data to the classes, variables, methods…

Jars Required For Hibernate Annotations

For working with annotations in hibernate,  ensure our java version must be 1.5 or higher and we must use hibernate version 3.3 or higher, and in fact no need to use all the jar files to work with these…

Hibernate Hello World Program With Annotations

Folks we will see one simple program with hibernate annotations, let us take inserting a record into the database application.  And remember in the annotations no need to write mapping xml, hope you remember…

Hibernate One To Many Annotation Example

Let us see an example on one to many annotations mapping… Files required.. Customers.java Vendor.java ForOurLogic.java hibernate.cfg.xml Customers.java package str; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = “Customers”) public class Customers{ @Id @Column(name = “custid”)…

Hibernate Many To One Annotation Example

Will find the example on hibernate many to one mapping using annotations Files required… Customers.java Vendor.java hibernate.cfg.xml ForOurLogic.java Customers.java package str; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; @Entity @Table(name = “Customers”)…

Spring Bean Autowiring Tutorial

Wiring a bean means configuring a bean along with its dependencies into an xml file like previous concepts, by default autowiring is disabled in spring framework.  It means the programmer has to explicitly wire the bean properties into an…

Example On Spring Autowiring byName

In this case, spring framework attempts to find out a bean in the configuration file, whose id is matching with the property name to be wired.  If a bean found with id as property name then that class object…

Hibernate Many To Many Mapping Using Annotations

Let us see the example on many to many using annotations Files required…. Categories.java Item.java hibernate.cfg.xml ForOurLogic.java Categories.java package str; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.Table; @Entity…

Hibernate One To One Mapping Using Annotations

Let us see the example on one to one mapping using annotations.. Files required… Address.java Student.java hibernate.cfg.xml ClientForSave.java Address.java package str; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import javax.persistence.Table; @Entity @Table(name=”Address”) public class…

Difference Between Merge And Update Methods In Hibernate

Both update() and merge() methods in hibernate are used to convert the object which is in detached state into persistence state.  But there is little difference.  Let us see which method will be used in what situation. Let Us…

Difference Between Hibernate Save And Persist Methods

Actually the difference between hibernate save() and persist() methods is depends on generator class we are using. If our generator class is assigned, then there is no difference between save() and persist() methods. Because generator ‘assigned’ means, as  a…

Ajax onreadystatechange Event Of XMLHttpRequest Object

Once the request been sent to the server,  changes will happen in the current webpage based on the response only.  The onreadystatechange event will be triggered every time the readyState changes. Here the properties of XMLHttpRequest object onreadystatechange A…

Ajax Onchange Fetch The Data From The Database

Let us see how to fetch the data from database onchange of drop down, actually this is the real time scenario, am using jsp  you can integrate with any type of frame works ( in .java files ), concept…

Struts Execution Flow Diagram, How Struts Works

Let us see the execution flow of struts2 Execution flow of struts When a client request is given, a web container will receive request Web container loads web.xml and verifies whether the url-patterns are verified or not, if matches…

Download Struts jar files, Jars Required For Struts Framework

In order to work with struts2, the following jar files are required, actually more than 6 but these are enough for simple application level. Working with the framework software is nothing but, adding the .jar(s) files provided by that…

Struts 2 Hello World Program

Let us see the Hello World program of struts 2, files required.. success.jsp error.jsp index.jsp LogingEx.java web.xml  struts.xml  Directory Structure index.jsp <%@ taglib prefix=”s” uri=”/struts-tags”…

Struts2 Login Application Example

Let us see the simple login application using struts2, but friends am giving with out validations, we will see in depth validations very soon 🙂 success.jsp error.jsp index.jsp LogingEx.java web.xml …

Struts 2 Store User Input Details In Separate Java Bean

Let us see how to store user input details in the separate bean, actually up to now we stored user input values in Action class by writing setters and getter methods, but there is a chance to store in…

How To Use Resource Bundle In Struts2

In struts2, if we want to get labels and error messages from an external file then we need to use resource bundle.  The resource bundle in struts 2 is similar to struts 1 but the difference is,  in struts…

Programmatic Validations With Resource Bundle In Struts2

In struts 2 we have 3 types of validations Programmatic validations Declarative validations Using Annotations First am going explain with programmatic validations… If we want to apply manual validations in struts 2,…

Aware Interfaces of struts 2

In struts2 we don’t have any http specific objects by default just like in servlets.  If at all we want any http related objects in our Action class then we need to implement our Action class from Aware Interfaces…

Example on ApplicationAware Interface of struts 2

So ApplicationAware interface, we need to implement our Action class from ApplicationAware interface when ever our Action class need to get context behavior, means we can share our data across all the files of the web application by putting…

Example on Struts 2 SessionAware Interface

Let us see concept behind this SessionAware interface in struts 2.x,  we need to implement our Action class from SessionAware interface in order to get HTTP Session behavior into our Action class. If we implement from SessionAware interface we…

XML Validations In Struts2 With Examples

Let us see the XML validations in struts2, we used to call this type of validations as declarative, what ever.  In struts2 if we want to apply the declarative validations then we need to use a set of per-defined…

Struts2 Validation Rules and Their Syntax

For every rule there is a class, all classes here are implements Validator interface required requiredstring stringlength int double date email url fieldexpression regex few other rules are there but light..!! For each rule given, there is an implementation…

Country State Dropdown Example With AJAX/Servlets

Folks this is similar to the country/state drop down using Ajax, i believe we have lot of examples regarding this country/state drop down so just would like to do little changes, so i converted into employee number and name….

Ajax,jQuery Auto Fill Dropdown On Page Load

Let us see the auto fill drop downs using Ajax and jQuery Files Required index.html db_fetch.jsp jquery-1.2.6.js (Add this jquery file at db_fetch.jsp location, same  folder) web.xml Index.html <html> <head> <script src=”jquery-1.2.6.js” type=”text/javascript”></script> <script type=”text/javascript”> $(document).ready(function(){     var xmlhttp;…

Checking User Name Availability With AJAX – Google Style

We will see how to check the user name availability in the database with ajax,  this is some thing what we can find out at time of gmail signup Files Required index.html pass.jsp web.xml Index.html <html> <head> <script type=”text/javascript”>…

How To Apply Multiple XML Validations On Same Field In Struts 2

Hi there, this is very important concept in real time, applying multiple validation rules on same field.  For example we have Email filed and we would like to apply 2 validations to this field like email, requiredstring. [ hey…

Struts2 XML Validations Example, Declarative Validations In Struts

In struts 2 we have 3 types of validations Programmatic validations Declarative validations Using Annotations i already explained how we can do programmatic validations,  now will see how to do declarative validations,…

Struts 2 datetimepicker Example

Let us see how to work with this datetimepicker in struts 2, actually no need to add any external jar files to work with this,  some of us may think we need to add some Ajax related jars bla…

Struts 2 Tabbedpanel Example

Let us see how to work with this struts 2 Tabbedpanel. jars required commons-logging-1.0.4.jar freemarker-2.3.8.jar ognl-2.6.11.jar struts2-core-2.0.11.jar xwork-2.0.4.jar Example files required index.jsp success.jsp web.xml struts.xml LogingEx.java Directory Structure index.jsp <META HTTP-EQUIV=”Refresh” CONTENT=”0;URL=resultAction.action”> success.jsp <%@ taglib prefix=”s” uri=”/struts-tags” %>  …

Using Struts 2 Autocompleter With Example

Let us see how to work with struts 2 autocompleter tag with example.  This autocompleter tag will works asynchronously, and dont forget to add <s:head theme=”ajax” /> in the header part of the webpage . jars…

Struts 2 Iterator Tag Example

Let us see how to use iterator tag in struts 2, actually iterator is the best tag to use rather writing while loop to print collection of objects in jsp’s.  if we use while loop we may need to…

Working With Struts 2 Interceptor With Example

In struts 1.x we have a RequestProcessor class if we want any per-processing services and post processing services for an Action, so that we used to implement in the RequestProcessor class, but this services will be executed for all…

Working With Struts 2 Tiles, Struts 2 Tiles Example

let us see how to work with tiles frame work in struts 2, tiles is the real time concept every body must know.  Actually tiles applications is little different than other applications we worked up to now, let us…

Struts 2 File Upload & Save Example

Let us see how to work with file uploads in struts 2 frame work, things to remember while working with this type of application See in index.jsp i have taken <s:file  name=”uploadFile” i mean my file tag name is…

What Is JSON, Complete Introduction To JSON

JSON is JavaScript Object Notation , and was invented by Douglas Crockford. Actually JSON is lightweight alternative to XML, language and platform independent script. Even JSON parsers & libraries are exists for…

Example On Converting JSON Text To JavaScript Object

Let us see this concept before we see an example JSON arrays are written inside square brackets Array can contain any number of objects Syntax {“names”: [‘+'{“name” : “java4s”, “address” : “United States”, “admin” : “sivateja”, “age” : 25},’+'{“name”…

Jars Required To Work With JSON In Java Applications

The following jars are required in order to work with JSON in Java programs. Please check the JSON Documentation before you start. Official site: json.org Jars required.. json-lib-2.2.2-jdk15.jar ezmorph.jar commons-lang.jar commons-logging.jar commons-beanutils.jar commons-collections.jar You can download from JSON official…

Using JSONObject In Java Programs

Let us see how to use JSONObject in java program, files required.. Jars required to JSON in java program.. json-lib-2.2.2-jdk15.jar ezmorph.jar commons-lang.jar commons-logging.jar commons-beanutils.jar ommons-collections.jar you can download these jars from previous session import net.sf.json.JSONObject; public class JsonEx {…

Struts2 Insert,Update,Delete,Operations Through JDBC [ Real Time Application ]

Let us see  on how to work with Insert,Update,Delete operations through struts 2 with JDBC connect, a real time application.  Even we will see the same application using Struts 2 and Hibernate. Actually i have not covered example on ServletRequestAware,…

Example On Spring Autowiring byType

Let us see an application on Spring Autowiring with byType, let me clear this confusion about byType,byName… Avoid byType – byName confusion In this case, spring framework attempts to find out a bean in the configuration file, whose id…

Example On Spring Autowiring by Constructor

Actually Spring Autowiring by constructor is similar to spring autowiring byType   but with little difference, in byType we used setter injection here we have to use constructor injection 🙂  nothing…

Example On Spring Autowiring by Autodetect

Let us see the example on spring Autowiring with autowire as autodetect.  Actually spring autowire=”autodetect” frist will works as Spring Autowiring constructor if not then works as Spring Autowiring byType, byType means setter injection right hope you remember 🙂 …

What Is ATG [ Art Technology Group ]

ATG – Art Technology Group was an independent technology company specializing in eCommerce software.   ATG’s solutions provide marketing, content personalization, merchandising, automated recommendations.   On November 2, 2010 oracle announced that is has agreed to acquire Art Technology Group. ATG’s…

Spring JDBC Complete Introduction

Friends, read this story carefully before you enter into spring JDBC. don’t dare to move further with out knowing this concept 🙂 ,its almost complete introduction to spring JDBC module. Spring JDBC Normal JDBC technology will be involved either…

About execute(sql) Method Of Spring JdbcTemplate Class

Better if we know some thing about execute(“static sql command only“) method in spring JdbcTemplate class… This method is used to execute both DDL and DML operations on the database execute() method allows only…

About update( dynamic sql ) Method Of Spring JdbcTemplate Class

Let us see few pints regarding update() method of JdbcTemplate class in spring framework update() method in spring JdbcTemplate class is suitable for DML operation on the database update() method accepts…

Query Methods Of Spring JdbcTemplate With Examples

Let us see the query methods of spring JdbcTemplate… queryForInt() queryForLong() queryForObject() queryForList() and 1 or 2 more but these are highly using methods, if you want i will give you the total query methods list.. 🙂 don’t fear…

Spring JDBC Hello World Example, Create Table In Database

Let us see how to create a table in database using spring JDBC. Files Required SpringJdbcCreateTable.java OurLogic.java spconfig.xml Directory Structure SpringJdbcCreateTable.java package java4s; import org.springframework.jdbc.core.JdbcTemplate; public class SpringJdbcCreateTable { JdbcTemplate jt; public void setJt(JdbcTemplate jt) { this.jt = jt;…

Spring JdbcTemplate Select Query Examples

Let us see how to use spring JdbcTemplate select query Files Required SpringJdbcSelect.java OurLogic.java spconfig.xml Directory Structure SpringJdbcSelect.java package java4s; import java.util.Iterator; import java.util.List; import org.springframework.jdbc.core.JdbcTemplate; public class SpringJdbcSelect { JdbcTemplate jt; public void setJt(JdbcTemplate jt) { this.jt =…

Spring JdbcTemplate Update() Insert Query Example

Spring JDBC, will see how to insert a record into database using JdbcTemplate class.  i mean using insert query in Spring JDBC using JdbcTemplate’s update() method.  Reason why i have used update() method for insert sql is update() method…

Resource Bundle In Spring: Dynamically Loading The Values For Property Placeholders In XML

Let us see how to load the values into spring configuration file dynamically using ResourceBundle concept Instead of directly placing the values into xml we can load the values at run time for the dataSource properties using ResourceBundle If…

Spring Resourcebundle Example

Let us see how to use Resourcebundle in spring jdbc Files Required SpringJdbcSelect.java OurLogic.java spconfig.xml jdbcBund.properties Directory Structure SpringJdbcSelect.java package java4s; import java.util.Iterator; import java.util.List; import…

What Is Log4j, Why Log4j Came Into Picture

For logging log4j is the best even today, let us see little history behind this 🙂 While developing Java/J2EE applications, for debugging an application that is to know the status of a java application at its execution time, in…

What Are The Main Components Of Log4J

We have mainly 3 components to work with Log4j … Logger Appender Layout Logger Logger is a class, in org.apache.log4j.* We need to create Logger object one per java class This component enables Log4j in our java class Logger…

Log4j Hello World Program

Let us see one simple program in Log4j For working with log4j, we must set log4j.jar in our class path Files Required Client.java my.txt   Directory Structure Client.java…

How To Create Log4j.properties File

In previous program, i have used FileAppender.  But if i would like to change my appender to JDBCAppender, i have to open my java file and do the modifications and need to recompile.  We can avoid this by  writing…

Example On Log4j.properties File With FileAppender & SimpleLayout

Let us see how to use log4j.properties file Files Required Client.java log4j.properties my.txt Directory Structure Client.java import org.apache.log4j.Logger; public class Client {   static Logger l =…

Log4j Example On Using FileAppender And ConsoleAppender Simultaneously

Let us see how to use FileAppender and ConsoleAppender at a time. Files Required Client.java log4j.properties my.txt Directory Structure Client.java import org.apache.log4j.Logger; public class Client {  …

Struts2 Custom Interceptor Example, Struts2 Interceptors

Let us see how to create user defined interceptors in struts2, we already know this fact that struts2 by default provided lot of interceptors. In fact we no need to create any custom interceptors 🙂 , but this is…

Struts 2 Hibernate Integration Example [ Struts 2 + Hibernate Integration]

Let us see how to integrate struts 2 application with Hibernate, a real time application. Make sure you are well aware of the following topics before you read this article. Static – Core HQL – Hibernate Taking separate bean…

Spring AOP(Aspect Oriented Programming) Tutorials

Hi friends, let us see the importance of Spring AOP(Aspect Oriented Programming), very very important module of spring framework.  In the enterprise level application programming we used to add different cross-cutting functionalities [cross-cutting functionalities means adding different types of services…

Spring AOP Terminology, Terms We Should Know Before Entering The AOP

Let us see the terms we should know before moving forward into spring AOP (Aspect Oriented Programming).  Friends these are very important, in fact spring AOP is nothing but knowing these terms in detail, noting in AOP 🙂 But…

Spring Aspect Oriented Programming – Aspect Introduction & Example

Yeah.., will see what is the meaning of this term Aspect in spring AOP. An aspect represent the cross-cutting functionality name, remember just name only. One real time service required for a business logic is called one Aspect. Aspect…

Spring AOP – Types Of Advice With Complete Explanation

We did see about Aspect already, Advice is the implementation of Aspect.  An Advice provides the code for implementation of the service. As an example consider logging  service, logging is an Aspect and Advice denotes the implementation of Log4j….

Example On Spring AOP Before Advice, After Advice

Hi friends…, will see one example on spring Before Advice, and After Advice. Files Required MyAfterAdvice.java MyImplClass.java MyInterFace.java MyWelcomeAdvice.java OurLogic.java spconfig.xml Directory Structure MyAfterAdvice.java package java4s; import java.lang.reflect.Method; import org.springframework.aop.AfterReturningAdvice; public class MyAfterAdvice implements AfterReturningAdvice {     public void afterReturning(Object…

Spring AOP Throws Advice Example With Complete Explanation

Will see how to work with Throws Advice in spring AOP. In this type of Advice, we implement services which are executed when ever the business logic of the method throws an exception.  For creating a Throws Advice our…

Spring AOP Around Advice Example With Complete Explanation

Will see few points about Around Advice before going to do an example 🙂 Around Advice is combination of both Before and After Advice. In a single Advice it is possible to implement both Before and After services. Around…

Spring AOP JoinPoint, What Is JoinPoint In Spring Framework

While creating the business logic of the method the additional services are needed to be injected (which we saw already) at different places or points, we call such points as join points.  At a join point a new services…

Spring AOP Pointcut Example

let us describe regarding spring AOP pointcut, for what methods what services need to be executed will be taken care by pointcut. A pointcut defines what advices are required at what join points.  In fact all business methods of…

Example: Get Autocomplete Feature In Java/Jsp With jQuery API

Hi friends, let us see how to get autocomplete effect in normal java/jsp applications, with the help of jQuery. I hope every body knows the importance of using autocomplete feature in java/.net or some other technologies.   Am going to…

Java/Jsp-jQuery : Auto Reload Part Of Webpage In Every 5 Seconds

Hi friend.., let us see how to reload/refresh any part of webpage in N number of  seconds , hmm you might seen this type of usage…

Spring AOP Static Pointcut Example

Pointcut verifies whether a particular method of particular class is eligible for getting the advice or not. It means the pointcut verifies the class names and method names, but not run time parameters of the method.  in spring AOP…

Submit Form Without Refreshing Page In Java/Jsp With jQuery

Hi friends, let us see how to submit form with out page refresh in java servlets applications with jQuery api.  i believe you can follow this procedure to implement the same in struts or any MVC applications too. Files…

NameMatchMethodPointcut Class In Spring AOP

NameMatchMethodPointcut class is going to verify whether the method names of a spring bean class are matching with the given criteria or not.  While configuring this pointcut class into xml, we use mappedName or mappedNames property of the class…

RegularExpressionMethodPointcut Class In Spring AOP

RegularExpressionMethodPointcut class is going to verify whether the method name of the class is matching with the given regular expression or not.  If matches then those methods are eligible to get Advices.  While configuring these classes into xml file,…

How To Convert ArrayList to String Array In Java

Hi friends,  In java some times we may need some conversions from collection objects to some thing, ArrayList to String array is very popular conversion we are using in our projects 🙂 import java.util.ArrayList; import java.util.List; public class Java4s…

How to Remove Unwanted Characters From String in Java

Friends, sometimes we may need to remove some unwanted characters from our strings, some thing if we have mobile number for example (123)-456-7891, i want to remove ‘ – and () ‘ symbol before storing this field in the database then…

How to Create User Defined Exception in Java

Apart from existing Exceptions in java, we can create our own Exceptions (User defined exceptions in java), we will how to.. Required files Client.java MyOwnExceptionClass.java  [ This is our own Exception…

How to Create Singleton Class in Java, Singleton Class in Java

Making java class as singleton is very important in some real time projects, we may need to have exactly one instance of a class. Suppose in hibernate  SessionFactory should be singleton as its heavy weight, and some other Banking…

Static in Java, Static Variables, Static Methods, Static Classes

Static in java  🙂 very important concept in interviews.  Let us see the story behind static variables and methods and classes in java classes…. Static Variables public class MyStatic { int var; static int var2; public static int methodStatic()…

Send Java EMail in Specific Time Interval Automatically & Dynamically

Let us see how to send automatic and dynamic email using Java, this application will send email in fixed interval of time, even if you want you can change this application to send email every day at particular time…

How to Remove Duplicate Values From Java List/ArrayList?

This is the question asked in our forum by some of our friend, even i faced this little issue once in my project 🙂 Some times we may not have chance to choose our own collection property.  For example…

Creating PDF with Java and iText, Generating PDF Using Java Example

Its very important in real time to convert the records or any statements into PDF,EXCEL,Word,TXT and some other formats too 🙂 now i will tell you how to generate PDF using iTextPdf API (simple API to generate PDFs in…

Check the Character/First Character Of a String is Number or Not in Java

Let us see how to find whether the given Character of a String is a number or first Character of any String is a number or not ? CharNumber.java package java4s; public class CharNumber { public static void main(String……

Difference between Java Set, List and Map Collections?

Let us see the main differences between Set,List,Map java collections.. Set (Interface) Set is an un-ordered collection which doesn’t allows duplicate (no-duplicate) elements We can iterate the values by calling iterator() method Set s = new HashSet(); Iterator iter…

How to Sort Arrays in Java, Arrays Sorting In Java

Hi let us see how to sort array of values in java, we can sort the arrays using Arrays class in java.util.*; package. Consider the following example.. SortArray.java package java4s; import java.util.Arrays; public class SortArray {     public static…

How to sort ArrayList in java, Sorting java Collections

Let us see how to sort values in java collections, List/ArrayList.  We can achieve this by using Collections class, Collections class contains a method sort(Collection Object), just give your collection object to the sort() method that’s it, consider this…

Difference between Arraylist and Vector in Java

Hi friends, let us see the main differences between ArrayList and Vector collections, this is very important and common question in interviews for all IT people, hope you might face this question in your previous interviews 😉 Any how…

How to Generate Barcodes Using Java, Barcodes Example

Let us see how to generate Barcodes with java, we have different types of barcodes, among them i am going to explain about ‘Code 128‘ type 🙂 Files Required BarCode128Java4s.java iText.jar [ Make sure you have iText jar file…

Send Java Email using Spring With Gmail SMTP Server Settings – JavaMailSenderImpl Mail

Let us see how to send java E-mail using Spring Framework,  sending E-mail using java is little hassle, we will always get class path or SMTP issues. But Spring providing this powerful class called, org.springframework.mail.javamail.JavaMailSenderImpl having 5 main properties,…

How to Load Java Properties File Dynamically From the Classpath

Why this properties file ? if we are using any application where there is a chance of constantly changing any credentials, something consider any java email application or any there you may need to change from,to or any properties…

How to Install SVN(Subversion) Plugin in Eclipse, SVN in Eclipse

What/Why this SVN ? this is a changes management tool, forget 😉 i will explain in normal language :-).  Consider you are working with XXXX project and have 5 members in your team.  Every body is working on different…

Spring Send Email With Attachment Using Gmail SMTP – Example

We know how to send a plane spring E-mail i mean without any attachments, Let us see how to send spring E-mail with attachment which is a similar application just like plane one, but with little modifications in MailLogic.java,…

What is servlet? An Introduction to Java Servlets

The basic aim of servlet is to develop web applications.  Before servlets came into picture there was a specification called CGI.  Servlets specification developed by SUN and released to the industry.   Lot of server vendors came forward for implementing…

Steps to Write Java Servlet Program

Let us see the basic steps to develop java servlet application… Servlet program is not like, writing java code and execute through command prompt.  We need to follow the following steps in order to develop any servlets program.  Even…

How to Write Deployment Descriptor,web.xml In Servlet

This web.xml is like index of book, web.xml is containing details of static web resource programs and dynamic web resource programs.  The purpose of web.xml is to hide to achieve the security for the web application by not…

How to Set Classpath For Servlet,setting Classpath For servlet-api.jar

As i told you in the previous article, we should set servlet-api.jar in our class path, in order to work with servlet applications.  We cannot run servlet applications if you didn’t set servlet-api.jar. Where Can You Download servlet-api.jar You…

Servlet Hello World Example in Eclipse IDE with Tomcat Server

We will see the first servlet application directly in Eclipse IDE and i am using Tomcat 7, friends doing java servlet with out eclipse is really tedious 😉 we cannot do every thing individually and copying related files into…

Methods in javax.servlet.http.HttpServlet

As we discussed in the earlier articles, we should extend our servlet class with HttpServlet abstract class in order to get protocol dependent services. When ever we make request to the servlet the following methods will be called…

Servlet Life Cycle in Java, Explanation of Servlet Life Cycle Methods

Aware of servlet life cycle is very important, before you going to execute first application. So let us see flow of life cycle methods… Java servlet will be executed in different stages, of which Loading the application and its…

Example on Servlet Life Cycle in Java

Let us see one example on servlet life cycle. Do you have any doubts related to the concept ? if so please check this Servlet Life Cycle theory article before you execute this example. Files required ServletLifeCycle.java web.xml Directory…

How to Retrieve Client Input Data in Servlet

When client send some input data to the servlet, that data will be available in the form of request object.  We can retrieve that input data through HttpServletRequest or ServletRequest interfaces.  There are 4 approaches to retrieve the client…

Example of request.getparameter(), Retrieve Parameters from HTML Form

Let us see how to use request.getParameter() method in the servlet class, to retrieve the input values from HTML page.  Friends it is base concept on retrieving the input data, so observe very carefully, also this is the first…

Java Servlet login Example In Eclipse

Let us discuss one simple login application using servlet and jsp, friends please refer previous articles if you still have any doubts regarding strvlets flow 🙂 Directory Structure Files Required OnServletLogin.java index.html web.xml index.html <form action=”login” method=”post”> <table> <tr>…

Example on getParameterNames() method of Servlet Request Object

So far we have worked on getParameter(), let us see how to use getParameterNames() method. With getParameter() we are able to find parameter values by passing parameter name, just like.. In html: <input type=”text” name=”n1″> In Java: String val=req.getParameter(“n1”);…

Example on getParameterMap() method of Servlet Request Object

Let us see about getParameterMap() method of servlet request object.  This method is little more useful compared to previous methods . Syntax Map m = request.getParameterMap() getParameterMap() method always returns Map object But how we will get input…

Example on getParameterValues() method of Servlet Request

The method getParameterValues() will generally came into picture if there is a chance of getting multiple values for any input parameter, this method will retrieve all of it values and store as string array. Syntax String values = getParameterValues(“Input…

Understanding ServletConfig and ServletContext

In our servlet application development, some of the programmers will write fixed coding , with in the servlet, which is not recommended.  For example, if we write database related code in our servlet, in future if…

Example of ServletConfig in Java Servlet

Let us see why/how to use ServletConfig interface in java servlet…. ServletConfig is one of the pre-defined interface. ServletConfig object is used for developing flexible servlets. ServletConfig objct exist one per servlet program. An object of ServletConfig created by…

Example of ServletContext in Java

ServletContext is one of pre-defined interface available in javax.servlet.*; Object of ServletContext interface is available one per web application. An object of ServletContext is automatically created by the container when the web application is deployed. Assume there exist a…

Difference between ServletConfig and ServletContext in Java

Let us see the main differences between ServletConfig and ServletContext, which is very popular interview question as well 🙂 ServletConfig ServletConfig available in javax.servlet.*; package ServletConfig object is one per servlet class Object of ServletConfig will be created during…

How to Connect Servlet to the Database with Example

Let us see how to connect servelet application with (Oracle) database, for time being i am considering Oracle XE.  In our application i am going to display all the records from the table ‘Java4s‘. Make sure you have java4s…

Spring MVC Execution Flow Diagram, Spring MVC 3.2 Flow

Let us see the flow of spring MVC (3.2). I am not going to describe what is M,V,C 🙂 hope you already know that mess right ? so lets start with the flow… Spring MVC 3.2 Execution Flow Step…

Spring MVC Hello World, Spring MVC 3.2 Hello World Example In Eclipse

Let us execute spring MVC hello world application with complete explanation, will see it in an eclipse 🙂 Open eclipse > File  > Dynamic Web Project Give Project Name > Finish Directory Structure Required Files Java4sController.java welcomePage.jsp web.xml welcome-servlet.xml…

Spring MVC Validations, How to Make Validations in Spring MVC 3

In spring there is no 100% best way to perform the validations, spring providing 3 types of validations mainly… Annotation Validations Manual Validations Mix of both Manual and Annotations But i am sure one that fits for your requirement,…

Spring MVC Annotation (JSR-303) Validation Tutorial

Spring MVC providing 3 types of validations hope you remember 🙂 if not have a look into the previous article. Annotation validation is one of them, let us see how to achieve annotation (JSR-303) validations in Spring MVC 3….

Spring MVC Annotation (JSR-303) Bean Validation With @Valid Example

Validating a (spring) bean is a mandatory thing in every IT individual project, let us see how to validate a bean in spring MVC JSR-303.  Please check this tutorial before you read this article .  In order to…

How To Sort An ArrayList In Java

This is one of the famous interview questions for freshers and even for the experienced developers 🙂 let us see how to sort the ArrayList in java. We have a class Collections in java.util package, which will do this…

How to Store Multiple Data types In An ArrayList

So, how to store objects of multiple data types in the ArrayList, in fact storing is pretty simple, every one will get some idea but how to retrieve the values ? for example if we have 100+ values in…

How to Install JadClipse Plugin in Eclipse ?

Today i will show you how to install JadClipse plugin in your Eclipse IDE. The main purpose of JadClipse is to decompile Java class files to source files in Eclipse. If you want to do so you must have…

How to Check Your Eclipse version Number ?

You can check your current eclipse version in different ways. Generally we will not consider eclipse version number as priority, but while you are installing some plugins, this will be the mandatory thing to consider your eclipse version number, depends upon…

How to Install m2eclipse (Maven) Plugin in Eclipse

I will show you how to install m2eclipse plugin in Eclipse IDE. Plugin m2eclipse gives complete support to Apache Maven. Before installing m2eclipse make sure you have Java SE and Eclipse EE version installed in your system, i have…

What is Web Services, Web Services Introduction

What is Web Services ? Over the internet, you might have seen different kinds of definitions for Web services. My definition will almost resembles them 🙂 Web Services, the name it self indicates that its a service which is available…

RESTful Web Services (JAX-RS) Annotations

This tutorial explains important annotations of JAX-RS for creating RESTful web services, friends i am giving these annotations just for your understanding purpose. you better know about these annotations before we go forward with the remaining RESTful web services…

How RESTful Web Services Extract Input Parameters

In this article i will show you how a RESTful web service will  extract input parameters from the client request.  We have different ways of sending input values to the rest services, and RESTful web service extract those details…

Jersey Hello World Example Using JAX-RS Specification

In this tutorial, I will show you how to develop a RESTful hello world web application with Jersey & Maven in Eclipse.  I have used Eclipse Juno to develop all web services. Make sure you have installed Maven plugin in eclipse before…

RESTful Web Services (JAX-RS) @PathParam Example

In RESTful (JAX-RS) web services @PathParam annotation will be used to bind RESTful URL parameter values to the method arguments. Lets discuss with a simple example. Note: If you are new to RESTful web services or if you would…

RESTful Web Services (JAX-RS) @QueryParam Example

In RESTful web services (JAX-RS) @QueryParam annotation will be used to get the query parameters from the URL, Observe carefully, i am saying we will retrieve the parameters only not their values.  But in case of @PathParam we will get…

RESTful Web Services (JAX-RS) @MatrixParam Example

In this article i will describe how a RESTful web services would accept multiple parameters sent by the client in the HTTP URL as Matrix Params. So what are matrix parameters ? let me give you the syntax. Matrix…

RESTful Web Services (JAX-RS) @FormParam Example

By using @FormParam annotation, RESTful web service would accept HTML form parameters sent by the client in the POST request and bind them to the method variables. Generally @FormParam will come into picture when client send the data in…

Download Files from (JAX-RS) RESTful Web Service

In this article i will show you how to download files from your JAX-RS  web service.  Downloading files from restful is easier compared to upload :-), however i will give you both examples.  We can download any type of…

RESTful Web Service (JAX-RS) JSON Example Using Jersey

This article describes how to get a JSON response from the RESTful web services using jersey implementation.  Jersey will use Jackson to convert Java objects to/form JSON, but just don’t ask me what is Jackson 🙂 ,as of now…

How to Test (JAX-RS) RESTful Web Services

In this article i will show you how to test RESTful web service (JAX-RS), so far we have learned how to create a RESTful service and testing GET and POST requests through some web browser.  But in real time…

JAX-RS XML Example With JAXB Using Jersey

In this article i will give you an example on how a RESTful web service produces XML response using Jersey. Basically JAX-RS supports conversion of java objects into XML with the help of JAXB. As Jersey it self contains…

RESTful Java Client Example Using Jersey Client

In this article i will describe how to write a JAX-RS client application using jersey client API, so far we used to call & test/read our RESTful service by its URL directly hitting in the browser [ check the…

JAX-RS Example of Multiple Resource Formats

This article will describe how a RESTful web service produces multiple output formats.  In the previous articles we came across how a RESTful service produces either XML or JSON alone as an output, but in this article i will…

Difference Between Hibernate get() and load() Methods ?

What is the difference between hibernate get() and load() methods ? this is one of the famous hibernate interview questions,  most of us will use hibernate get and load methods irrespective of knowing their exact behavior 🙂 will you…

AngularJs Hello World Example

Hi there, lets see how to write a Hello World example in AngularJs.  As this is the first Angularjs example i will make it as simple as possible for you 🙂  For creating AngularJs applications we need to include the…

AngularJs Controller Example, Controllers in AngularJs

In the previous tutorial, i have explained how to create a simple application without a controller.  But in this example i am going to use a controller.  In order to create a controller firstly we should create a module…

AngularJS Directives Tutorial

In this article i will describe about the directives in the AngularJs.  Simply in a single line we can say, angular directives will extend the functionality of HTML elements. We will use these directives as an attribute for the…

Difference between String.equals(“value”) and “value”.equals(String) in Java ?

Its very often to use String equals() method in our programming, today i will show you the efficient way of using string equals method. we can write equals() method in two different ways 🙂 “value from the database”.equals(“string to…

Java Bloggers Meet at Hyderabad to Celebrate 20th Birthday of Java, Hosted by Oracle

This is not a technical article 🙂 this is regarding an event hosted by Oracle on 13th June 2015 at Oracle office, Hyderabad. Couple of days back I got an invitation to attend this event, initially I thought it’s…

How to Create Custom Directives in AngularJs

In this article I will describe how to create custom directives in the AngularJs. Custom angular directives are the markers of DOM element, I mean we will write the custom directives as normal HTML elements, attributes, CSS classes and as…

AngularJS Filters – Java4s

In Angularjs filters can be used to format the data, format means changing the text/data to upper/lower case or capitalize the first letter and showing the numbers in currency format and many more. Generally we can use filters in…

How to Create Custom Filters In AngularJS

In the previous article, we had a look at built-in Angular filters, these built-in filters will cover many common use cases, but you can also create your own filters in Angular 🙂 by writing logic based on your requirement. Hmm…

Understanding of Angular’s $rootScope and $scope?

In this article I will describe the relation between Angular’s $rootScope and $scope and how they will work. As I have explained in AngularJS Controller Example, $scope will work as a mediator between our view and controller for carrying…

How to Convert String to char Array in Java

In java we have built-in function String.toCharArray() to convert String to char array. But for sure in the interviews they will ask you to write a program to convert string to char array without using the built-in functions 🙂…

How to Convert String to int in Java

In Java we can convert string to integer with Integer.parseInt() function. Java String to int Example public class StringtoInt { public static void main(String args) { String str = “4”; int in = Integer.parseInt(str); System.out.println(in); } } Output: 4…

How to Convert String Array to List in Java

Its very often scenario to convert String Array to list in real time projects . In java we have inbuilt function to convert String array to List. Syntax: Arrays.asList(“Input String array“); Java String Array to List Example import java.util.Arrays; import java.util.List; public…

How to Convert List to Map in Java 8

If you have a scenario where you need to convert List of objects to a Map, prior to java 8 you can do this by writing a simple for loop which is iterative. But in this article I will…

How to Install Node.js and NPM on Windows

In this article I am going to show you the steps to install Node.js and NPM  in your Windows PC. I am not going to cover anything about Node.js  😉 this is just about installation…

Exception Handling in RESTful Web Services (JAX-RS) with Jersey

Exception handling in RESTful (JAX-RS) web services is a very important concept, in this article I am going to explain it step by step with an example. FYI. check this article for Creating Simple Maven RESTful Web Service Project in Eclipse….

Spring Boot – Introduction Tutorial ( Don’t Miss )

Spring Boot is a framework developed on top of core spring framework. The main aim of Spring Boot is to let developers to create spring production grade applications and services with very less effort. Did you remember, what it…

Spring Boot + Maven – Hello World Example Step by Step

In this article, I am going to explain the steps to create a Spring Boot hello world application using Spring Tool Suite(STS) and Maven. Friends follow this article carefully, as this is the first spring boot application I am…

Spring Boot – Creating a RESTful Web Service Example

In the previous article we have just created a simple hello world spring boot application, in this tutorial I am going to show you how to create a Restful web service using Spring Boot, believe me its very simple…

Spring Boot – Common Application Properties (application.properties)

In this article I am going to explain about Spring Boot’s application.properties.  Generally we will create property files for writing static values related to our application. If you consider some real time java applications, we will use these .property files for writing  environmental (server)…

Spring Boot – How to Change Default Tomcat Server Port

In our previous RESTful example, when we start the application Spring Boot’s inbuilt tomcat server by default will take 8080 as its port number, did you observe that 🙂 go back and have a look once. In this article, I…

Spring Boot – How to Change Default Context Path

Firstly what is this context path? simply its our application name. Generally while we are hitting any application in the browser, we will write the URL with the application name(context) right? I mean… http://localhost:<port>/<application_name or context_path>/operation_name But if you check Spring…

Spring Boot – How to Reload Changes Without Restarting the Server

One of the main challenge for the java developers is to deploy the apps and restart server when ever there is a code change. In this article, I am going to show you how to reload the code changes without…

Spring Boot JDBC + MySQL – How to Create/Configure a DataSource

In this article, I am going to explain you how to create/configure a datasource in Spring boot with an example. We are all aware that the process of creating a traditional Spring JDBC application is little tedious because of its XML…

Spring Boot JDBC + MySQL – How to Configure Multiple DataSource

In the previous article we saw how to configure a datasource in a spring boot application,  that’s very straight forward.  In this article I will show you how to configure multiple datasources in spring boot application. Unlike single datasource, in order to create…

How to Deploy Spring Boot Applications on External Tomcat Server

So far, in previous examples we used to deploy and run the applications using embedded tomcat server provided by the spring boot. Generally in the real-time projects we wont use inbuilt servers provided by the frameworks because of many reasons…

Spring Boot + Spring Security – RESTful Web Service with basic Authentication

In this article, I am going to explain you how to implement basic authentication for RESTful web services using Spring Boot and Spring Security. We will need to create a java file with spring security configurations in it, that’s…

Spring Boot + Spring Security – RESTful Web Service with Database Authentication

This article describes how to implement database authentication for your RESTful web services using Spring Boot and Spring Security. Let me start with the required dependencies.. Dependencies <!– Related to Database –> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId>…

Spring Boot + Spring MVC + JSP Hello World Example

This article describes how to create a Spring MVC application using Spring Boot. As this is an MVC application unlike previous examples, we have to create a webapp folder under /src/main (src > main > webapp) where we will place all…

Spring Boot – Example of RESTful Web Service with XML Response

Spring boot services by default gives the response in JSON format, but we can reverse this functionality in such a way that the default response will be in XML.  In order to do that we have to add a…

Spring Boot – RESTful Web Service with POST Request in JSON Example

In the previous articles I didn’t get a chance to use the POST request in the examples, but this is very important. In this article I am going to show you how to create a Spring Boot REST service…

Spring Boot – RESTful Web Service with POST Request in XML Example

In this article I will am going to show you how to read XML data from REST request using Spring Boot. As I told you in the previous articles, spring boot by default support reading and producing the JSON data. But for…

Spring Boot – Display All Beans Available in ApplicationContext

In this article, I am going to show you how to see the beans that are loaded by the Spring Boot from the ApplicationContext.  What we have to do is implement main class with CommandLineRunner/ApplicationRunner interface and override its run…

How to Configure Cache in Spring Boot Applications

In this article, I will explain step by step how to configure cache in spring boot applications.  Caching helps to increase the performance of the application by reducing number of round trips between the database or any expensive resources….

Spring Boot Configure DataSource Using JNDI with Example

We already saw the default approach to configure datasource, in this article I am going to explain you how to configure datasources using JNDI lookup in spring boot applications.  Before you read this article, I highly recommend to read How…

If you enjoyed this blog, please consider sharing it...!!!
Most Recent Posts from Top Categories
Spring Boot Hibernate Spring
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2022 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.