background preloader

Java

Facebook Twitter

Spring MVC Interview Questions with Answers - HowToDoInJava. These Spring MVC interview questions and answers have been written to help you prepare for the interviews and quickly revise the concepts in general.

Spring MVC Interview Questions with Answers - HowToDoInJava

I will strongly suggest you to go deeper into each concept if you have extra time. The more you know, more you are confident. Table of Contents What is Spring MVC framework? What is DispatcherServlet and ContextLoaderListener? What is the front controller class of Spring MVC? What is Spring MVC framework? The Spring web MVC framework provides model-view-controller architecture and ready components that can be used to develop flexible and loosely coupled web applications.

Clear separation of roles -- controller, validator, command object, form object, model object, DispatcherServlet, handler mapping, view resolver, etc. What is DispatcherServlet and ContextLoaderListener? Spring’s web MVC framework is, like many other web MVC frameworks, request-driven, designed around a central Servlet that handles all the HTTP requests and responses.

Microsoft SQL Server Index Architecture. Spring MVC 4.0 RESTFul Web Service JSON Response with @ResponseBody. Article Recognitions* A mention about this article in official spring blog here.Big Link in Dzone This tutorial is a continuation of my previous tutorial titled Spring MVC 4.0 RESTFul Web Service Simple Example.

Spring MVC 4.0 RESTFul Web Service JSON Response with @ResponseBody

I explained the basics of how Spring MVC can be used to build RESTFul Web Services with a simple example that returns greeting message in the form of plain text. Let us extend that example to see how to use Spring MVC REST functionality to return json response from server. As I mentioned in my previous article, we can eliminate the usage of ViewResolver as Spring provides an out of the box functionality wrapped inside @ResponseBody annotation. In this tutorial, I am going to explain with an example, on how to build Spring RESTFul Web Service that would return user information in JSON format from an underlying MySql table. Lets get started with our sample application, Spring MVC 4.0: Consuming RESTFul Web Services using RestTemplate. This article is a continuation of my previous article on Spring MVC 4.0 RESTFul web services.

Spring MVC 4.0: Consuming RESTFul Web Services using RestTemplate

So far I have written two articles on how to create restful web service using Spring MVC 4.0. Last tutorial explained how to create a RESTFul web service in spring that would return user information from mysql table in JSON format. Let us now implement a Spring MVC application that issues web service requests and fetches the response returned by the web service. In this tutorial, we will extend our previous example to include a class that fetches user data from the spring service we had already created and display it in a jsp page (view). Spring MVC is a complete framework with lot of inbuilt features that facilitates easy and quick web development, including a template class - 'RestTemplate' for consuming web services. I assume that you have gone through my previous article and have created a web service as explained. RestTemplate Table Source : Java JSON parser Example.

JSON is a simply text format that facilitates reading and writing.

Java JSON parser Example

It is a widely used data-interchange language because its parsing and its generation is easy for machines. In Java language there are some ways for JSON processing. In this example we are going to use a common Java toolkit for JSON – JSON.simple – and we will find out how to parse every type of a json file. 1. Set the Environment Before start coding we have to set a proper environment for the compiler, in order to recognize the JSON's classes. Otherwise, you have to add the newest version of json-simple-1.1.1.jar in your CLASSPATH. Spring MVC 4.0 RESTFul Web Service JSON Response with @ResponseBody. Spring Restful Web Service Example with JSON, Jackson and Client Program. Getting Started · Building a RESTful Web Service. In Spring’s approach to building RESTful web services, HTTP requests are handled by a controller.

Getting Started · Building a RESTful Web Service

These components are easily identified by the @RestController annotation, and the GreetingController below handles GET requests for /greeting by returning a new instance of the Greeting class: Sample Program - Java String Manipulation, String creation in Java, charArray to String in Java, isEmpty() & length() in Java, Different way to use concat() in Java, charAt(), indexOf() & lastIndexOf() in Java, compareTo() & compareToIgnoreCase() in Java, Spring MVC + jQuery Autocomplete example. In this tutorial, we show you how to integrate jQuery autocomplete plugin with Spring MVC.

Spring MVC + jQuery Autocomplete example

Tools and Libraries used : Spring MVC 3.2jQuery autocomplete plugin – githubMaven 3Eclipse IDE Review the tutorial’s flows : An HTML page, with a textbox.If the user is tying on the textbox, it will fire an Ajax request (via autocomplete plugin) to Spring controller.Spring process the user input and return the search result (in JSON format).The “autocomplete plugin” process the returned result and display the autocomplete suggestion box. Spring Tutorial 05 - ApplicationContext and Property Initialization. Spring MVC Interview Questions with Answers - HowToDoInJava.

Design Patterns

Abstract Factory Design Pattern in Java. Back to Abstract Factory description Abstract Factory classes are often implemented with Factory Methods, but they can also be implemented using Prototype.

Abstract Factory Design Pattern in Java

Abstract Factory might store a set of Prototypes from which to clone and return product objects. Factory Method: creation through inheritance. Prototype: creation through delegation. Virtual constructor: defer choice of object to create until run-time. D:\Java\patterns> java FactoryFmProto "short" "lie" "old" "my way, or the highway" "take test, deal with the results" D:\Java\patterns> java FactoryFmProto 1 "vertically challenged" "factually inaccurate" "chronologically gifted" "do it your way, any way, or no way" "you pass, self-esteem intact" Read next This article is taken from our book Design Patterns Explained Simply.

All of the design patterns are compiled there. We distribute it in PDF & EPUB formats so you can get it onto your iPad, Kindle, or other portable device immediately after your purchase. Learn more.