Tag: java
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,…
What is Hibernate – Hibernate Introduction
In this tutorial am going to explain, why Hibernate came into picture though we have JDBC for connecting to the database, and what is this hibernate frame work first let us see what are the draw backs of JDBC…
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 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()…
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…
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 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…
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…
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…
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…