Featured
-
How to split a String
Below I have written a code to split a string.
by shahbaz.ahmmod -
Send Push Notification with Custom Data to iPhone device from Java Server Side
This blog will help you to send Push Notifications
by babita.dhami -
Tomcat and Eclipse Integration Error : “Unknown version of Tomcat was specified”
If you are adding Server in Eclipse for Tomcat, an
by chandan.ahluwalia -
Spring MVC and MongoDB
Repository Class Using MongoDB : Spring has th
by sumit.vyas -
How to create DLL file from java?
Hello Guy's This Blog will guide how to create D
by bhagwan.khichar
Tags
Find java and java control panel in ubuntu
Command to find java on ubuntu
find ./ -name java
Location of control panel in ubuntu
Go to java installation directory
> cd /usr/lib/jvm/java-7-oracle/jre/bin
> ControlPanel
Spring @RequestHeader Annotation
Spring @RequestHeader Annotation
Spring MVC provides annotation @RequestHeader that can be used to map controller parameter to request header value. Here is the simple usage of spring @RequestHeader annotation.
import org.springframework.s...
Send Push Notification to Android Devices from Java Server Side
This blog will help you to send Push Notifications to Android devices from server side where server side code is written in Java.
Follow the below steps in order to send Push Notification:
Put the gcm-server.jar into your lib folder of y...
Is custom Spring Web Context Configuration is required for any Spring application?
Is custom Spring Web Context Configuration (like applicationContext.xml) is required for any Spring application?
As per knowledge, necessarily no need it, but it is a good way to separate your application layers from front-end layer:
As we ...
Change Spring Web Context Configuration Filename
Change Spring Web Context Configuration Filename
We know that if we want to implement the Spring MVC in our project then we should add DispatcherServlet into our web application deployment descriptor (web.xml) file like as below
<servlet...
Hibernate with multiple Databases/SessionFactory.
Hibernate with multiple databases/session factory :
To use Hibernate to support many databases, We have to follow following steps.
1 - We have to create multiple SessionFactory/cfg.xml files for each Database we want to use/connect.
2 -...
Solution for java.lang.IllegalStateException
Hello friends, sometimes you come across with this very unexpected exception.
For eg: In the given code, after execution this exception occurs..
@RequestMapping(value = "addUser")
public String addUser(@ModelAttribute("userForm") UserF...
What is web.xml ?
web.xml is Deployment Descriptor which consist all the basic configuration servers( like Tomcat) need to know at the time of deployment like context path, url mapping, listener, filters, error and security.
you can mentioned following in web.x...
Getting lat/long from ZipCode in Java
By using Java API Geocoder, it is easy to get geographical information of any location. The response will be in JSON or XML format.
Write the following example to get Latitude/Longitude from Zip code:
String postCode = "07001"; // you can u...
Spring MVC Exception handling using @ControllerAdvice Annotation
Spring MVC provides a great way to handle exceptions and errors.
@ExceptionHandler annotation is core to this feature. For each Spring controller we can simply define a method that automatically gets called if a given exception occurs.
For e...
Amazon SES Client Mail Integration in Java
Using the Amazon SES SMTP Interface to Send Email
To send email using the Amazon SES SMTP interface, you will need the following:
An AWS account. For more information, see Signing up for AWS.
The SMTP interface hostname and port number. ...
Char array is better than String for password prevention
Why Char array is better than String for storing secure data like Password in Java?
As we know that String is immutable in Java if we store password as String, it will be available in memory (Heap) until Garbage collector clears it and since S...
Use of JSTL tag
1) Iterate List/HashMap in JSP using JSTL
To use JSTL in your jsp file, you should first include below statements
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="ht...
Best way to configure hibernate 3 with spring?
Different way to configure hibernate 3 with spring?
As per my knowledge There are 3 different way to configure Hibernate 3 with spring 3. Let us sort discuss on each of three configuration method and lastly conclude witch method is best.
Me...
toString() in java
toString() method is very useful and frequently used by java developer. What is toString()
?
As per java doc: 'toString() method returns the string representation of the object.'
toString() method belongs to Object class, So each and every o...
Best way to Concatenate Strings in java
Optimized techniques for Concatenating Strings in java.
We can concatenate multiple strings using either + operator or String.concat() or StringBuffer.append(). Which is the best one interms of performance?
The choice depends on two scen...
Log4j setting in Maven project
As per maven project structure, there is a resource folder where all application related properties will be added. Implementation of log4j in MAVEN application,
Create log4j.properties file inside resource folder and paste below code lines:
...
Spring configuration Red 5
Red5 Media Server delivers a powerful video streaming and multi-user solution to the Adobe Flash Player and other exciting client technologies. Based on Java and some of the most powerful open source frameworks, Red5 stands as a solid solution fo...
How to Create Immutable Class in Java
How to create Immutable class in java
Immutable class is a class which once created, its contents can not be changed. Immutable objects are the objects whose state can not be changed once constructed. e.g. String class
Since the state of the ...
Hibernate environment in Spring
Spring comes with a family of data access frameworks that integrate with a variety of data access technologies. Whether youre persisting your data via direct JDBC, iBATIS, or an object relational mapping (ORM) framework such as Hibernate, Spring...
Marker/Null interface in java
Marker Interfaces or Null interface in Java are special type of interfaces in character as they have no methods declared in them which means that if any classes implementing these interfaces don't have to override any of the methods.
JDK provi...
SSL By Pass
When we have a client/server application. There is certificate(SSL installed) in server side. So In that case we have a problem , how to extract data.In this case we can by pass the SSL just writing few lines of code.
Write the below code b...
how to differentiate synchronized block and synchronized method in Java
The synchronization is the mechanism by which we can control multiple threads to access the shared resources. Without synchronization, it is possible for one thread to modify a shared resource while another thread is in the process of using or up...
How to install "Open Jdk" (java developement kit) in Ubuntu(Linux)
**Installation of JDK on Ubuntu is very easy just follow below Steps**:
Java is typically installed in /usr/java locate the version you have and then do the following:
Open Terminal.
Use Command.
sudo apt-get install openjdk-7-jdk
Af...