Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Send data through ajax call and receive Json response from controller in Springs

Here is the sample code implementing ajax call to send the data of a form to the controller and receiving json response from controller. Student.java Create a java bean class and generate setter and getter. public class Student { ...

Spring Security 4: Auto login with annotation

Spring security gives us the feature to auto login into the system just after creating an account. Other way is to register then go to login page, and then login to the system. When we login login mechanism spring automatically creates the sess...

Remove some particular character from a String

Sometime, we need to remove or replace some particular character from a String. Below is the method by which we can accomplish this. I am using replaceAll() method of the String. replaceAll() have two parameter as an arguments. First one is t...

Sort alphanumeric string with awareness of number using Java comparator

The java by default sorting is based on either number or string. If we try to sort a alphaneumeric it will be treated as an string so the sorting will come something like: 1abc 11abc 2abc instead of 1abc 2abc 11abc So in such cases w...

To create database and insert data in SQLite, in android

If you are looking for the code in android to create database and insert data in SQLite then follow the steps mentioned below:- 1) Create a layout in which the data will be filled that will be inserted into database. activity_signup_form....

How to reset ArrayList in Java - Clear vs RemoveAll

To reset ArrayList we have two options, one is to use clear() method and another is to use removeAll(). We dont need to worry if size of the ArrayList is small i.e. 10 to 100. But if ArrayList size becomes huge the difference in the performan...

Convert Map to List

Map and List are the two commonly used data structures Here I am writing way to convert Map to List. Basically Map holds two things are key and value on the other hand list holds only values. Both Map and List allow duplicate data. Below i...

How to execute additional code just after opening a new page using Angular JS

In the cases when you execute any server and your attempts to load a new page view and then your codes in directive gets loaded before your services are updated so you can using $rootScope. This is an example of above case View <serv...

Threads

Threads Threads are used to get the multiple activities in a single process. They are light weight programs. They share memory and files and process state. They have their own local variable and stack and program counter. Every jav...

Static Keyword

Static Keyword Static keyword can be applied on 1.Method 2.Variable 3.Class nested within another Class 4.Initialization Block Static keyword can not be applied to 1.Class (Not Nested) 2.Constructor 3.Interface 4.Met...

Convert String to Date in Java

Its very easy in java to convert String to Date. Java provides SimpleDateFormat to handle Date related functionality. Here we call parse() method of SimpleDateFormat. Example import java.text.SimpleDateFormat; import java.util.Date;...

Phone number Regex Java

Regex for mobile number validation with prefix of '+' ^[+][0-9]{12,13}$ Regex for mobile number validation with optional '+' ^[+]?[0-9]{10,13}$ Use in Code:- Pattern.matches("^[+][0-9]{12,13}$",mobilenumber); Ha...

Java Need

Hello I want to learn Java programs from easy to expert Level can you suggest me some sites for It?

Constructor in Java

Java Class Constructor It is special kind of function, but doesn't have a return type. It has the same name as class name. Constructor is used to initialized the variable of class. we can't call the constructor with the help of object. If...

Get Current Date in Java

Hello, We need current date in many situations. Here I am writing different ways to get current date in java. 1. Get current date using java.util.Date. Date currentDate = Date(); System.out.println(Current date : +currentDate); O/P: Curr...

How to put coma between hundreds and thousands of any given number

Hello reader's! On a given number format if you want it to be customize like a figure with separated by (,) like 128,347,556. By using a function and in the function we will Preg Match the string with every hundreds and thousands You can use...

Covariant Return Type

When return type of the method of super class is different than the return type of method of subclass and it is also a method overriding then it is known as covariant return type. And here the return type is non primitive. I am writing the si...

Access Denied in spring security 4 even after successful authentication

In spring security after successfull authentication I was getting the Access denied error to go to pages which had the authentication. What I did was. @Override protected void configure(HttpSecurity http) throws Exception { ht...

How to add multiple properties file in spring configuration

Here we have configured the spring mvc configuration. In @ComponentScan we can give the path where we have our components(like controller, model, dao etc). For adding the single properties file we use: @PropertySource("classpath:application.p...

How to disable csrf spring security 4

In spring security bydefault the csrf protect in on. As a result it asks for token during login and other requests. Although its not a good practise to disable the protection but we can do it. As we can see in the code below, http.csrf().disable...

How to authenticate MD5 password encyption in spring security 4

Whenever we deal with password in an application, we go for some encryption. In spring the password it authenticated within the configuration. Here is the sample code where we have already saved the password in encrypted form and now during lo...

Encapsulation

Encapsulation is a concept of wrapping up of data into a single unit and hiding implementation details from the user. If we use the private method then they can not be accessed in the other class. If we put a getter setter method to update ...

Final Keyword

Final is keyword that can be used before a class or method or a variable. Final Class They can not be subclassed and the method in it are by default final. public final class MyFinalClass {...} public class ThisIsWrong extends MyFinal...

Access Modifiers

Access modifiers in java are used to control the access of other classes to access the class or method. There are different type of access modifiers used 1.Public-It is the default access modifier it means that your class or method is visib...

Exception Hnadling

Exception handling in java is a way to catch error or exception Exception is an event that can occur during the execution of the program. We use try catch and final to catch error. When an error occur in a method it creates an object of ...

Interface vs Abstract Class

Interface Interface can extend many interface. Interface can extend from a interface only. Interface have only abstract method by default. Interface can have public method only it it. Abstract Abstract can attend only on class at a time. ...

Abstract Class

Abstract class are simply the base class. They can not be instantiated but can be subclassed and have protected, private method unlike the interface. Abstract classes can be declared by simply using the keyword abstract. abstract class Graphi...

Interface

Interface is the way to get the multiple inheritance. This means that a class can inherit two or more class. As java, we can not extend more than one class but we can extend more than one interface. So Interface is used to have inheritance Bu...

Inheritance

Inheritance in java is concept by which one class can have the method of the other class. The class that is being inherited is called Base or Parent class and the one which derive is called the Derive or child class. Inheritance can be of the t...

java web app is not uploading images

Hello, I need help to understand why my java MVC doesn't upload images. There is no errors just nothing happening. My project is on dropbox DropBox Please help me because I'm totally stuck with this. Please look on it and tell me if there is...

Method Overriding

Method Overriding is a type of polymorphism. It is dynamic type of polymorphism. In this we have the method with the similar name in both parent class and child class. But the child class override the method of the parent class when we create ...

Method Overloading

Method Overloading is a type of polymorphism. Using this we can have two different method having the same name in a single class. Method have the same name but different argument through which they are recognize. Argument have 1.Different num...

How to start debugging on a specific frame while debugging an android app using android studio?

I am using android studio. While debugging my app I want to jump to the specific frame and start debugging from that frame, skipping the other frames in the frames tab. I want to see the frames that are only related to my android application a...

HttpSessionAttributeListeners in Servlet

In Servlet we can also track the events using the Listeners, In below code script we have to track the events using the listeners. we have easily maintained the HttpSession events with the HttpSessionAttributeListener while we add, remove or repl...

Java database statment problem

Hello all, I dont know what im doing wrong, i only want to check the username and password in the database if they exist show, you are logged in but if they do not exist to show.. you have no access to db public void logIn(Student student) ...

Java bit processing

Hello, I want to process a file.txt at the binary level by removing every 5th bit if it is equal to 1. Save the new processed binary file and repeat the process until it can no longer find any more 5th bits equal to 1, then save the final file...

Stack in java

In stack, we save elements in last-in, first-out manner. Stack extends the Vector class and have only one constructor that is default. By this default constructor, we can create an empty stack. Below is the example. public class Exampl...

How to know the call state in Android

Android provide us the facility to know the call state. Android gives this feature by providing Telephonymanager class. We need to implement PhoneStateListener interface that has one method onCallStateChanged(). Below is the example. publ...

SortedSet in Java

I am writing a way to implement SortedSet in java. SortedSet have the properties of Set interface plus feature of sorting in ascending order. It is by default provides elements in ascending order. It is very useful in such situation when we do...

LinkedList implementation in Java

Hi friends, Here I am writing a way to implement basic LinkedList. First of all LinkedList has the properties of List interface and AbstractSequentialList class because it implements List interface and extends AbstractSequentialList. ...

No options for import in Eclipse IDE

I am trying to import a gradle project into eclipse. However, when I do File -> Import, it gives no options. How can I fix this? Thanks.

Implement Producer Consumer Problem Using Threading in Java

ProducerConsumer problem is also known as the bounded-buffer problem.It is multi-process synchronization problem.There are two processes one is producer and another is consumer that can share a common and fixed-size buffer. The producer insert th...

Adding and Deleting items in dropdown using javascript.

Hi Readers! In this blog we will learn How we can Add and Delete items in dropdown in JavaScript. .In the bellow example we are going to add items in dropdown and delete selected item from the dropdown list on specific button click . <...

Implement Generic Method in Java

Generic Methods:- The Below code will helps you to implement Generic Method using the Generic Programming in Java. The generic methods enable us to specify, with a single method declaration and use with different data types. we can write a single...

How to Construct your own ArrayList Using Generics

Here the Below Example will show you how you can construct your own Collection(ArrayList) in Java. The below example will show you that our Class Generics will behave like the ArrayList. I have use the Generic Programming to Implement the concept...

Static in Java

One of the most important topic that we encounter in java. We can use static with class name, methods name, variables name and block. Static keyword mainly used for memory management. Static variable Static variable takes memory o...

Spring MVC @RequestParam Usses

For Get request we need to pass parameters as request param along with the url to get the data. In Spring MVC framework, we can customize the URL in order to get data. To read the parameters passed with the URl we use @RequestParam in Spring fram...

Spring MVC @RequestParam vs @PathVariable

@PathVariable: Sometimes we need to pass parameters along with the url to get the data. In Spring MVC framework, we can customize the URL in order to get data. For this purpose @PathVariable annotation is used in Spring framework. @PathVariabl...

How to match a word in Java?

Sometimes we need to match some words in a particular String. We can do this easily by matches() method of String class. Example: package com.demo; public class TestApps { /* *@param args */ public static void mai...

How to replace whole word with Word Boundaries in Java?

Sometimes we need to replace whole word with the word boundaries in a string. For this we use "\b" regular expression token which is called a word boundary. It usually matches at the start or the end of a word. Example: You just need to place ...
1 6 8
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: