As we all know all enterprise application depends on database. Database could be from any vendor but all supports stored procedures. When application becomes big and lots of complex database queries gets involved then developers starts moving towards stored procedure or functions. Here is a simple example how to call stored procedure from Java code
Maven is one of the project management tools which is used in most of the projects. This makes developers life much easier. Maven uses repositories to load jar files into projects. These jar files should be available on Maven 2 repository. Maven download jar from Maven 2 repositories to local repository. But some jar files
What is Hibernate? Hibernate is an Object/Relational Mapping solution for Java and .Net environments. It was initiated by Gavin King in 2001 and latest version today is 4.1. Hibernate originated in order to simplify better persistence capabilities over EJB 2. The basic idea of object relation mapping – ORM is to map database table to
Spring provides a mechanism to intercept the request before it is handled by handler method. Any class can act as an interceptor provided it implements HandlerInceptor interface. This interface has three methods which gets called at different points. Methods in HandlerInceptor Interface preHandle(): This method is invoked before the handler method gets invoked. Return Values
@ModelAttribute annotation is used as part of MVC web flow. This is used for preparing the model data and to define the command object that would be bound with the HTTP request data. This can only work if the class is annotated with @Controller. This annotation can be used on method or on method parameters.
We have seen two most frequently used elements of @RequestMapping annotation. Other which can be used are consumes, produce, params and headers. consumes: This element will consume given content-type specified. produces: This element will produce response of content-type specified. Here is an example. Above handler method will only handle request with specified mapping and content-type.
We have seen in first part how primary mapping can be defined using value element of @RequestMapping. Here we see what other elements do in @RequestMapping annotation. All the other @RequestMapping annotations are used for narrowing down the primary mapping. method Second most important element is method which tells which handler method will get invoked.
As defined in this post what controllers and which is the most important annotation which makes it handle request from client. @RequestMapping annotation comes with number of optional elements which decides the behaviour of a handler method. Following are the elements which can be used with @RequestMapping. S.No. Element Modifier & Type Description 1 value
What are Controllers? Controllers are usually JavaBeans which interprets request. After DispactherServlet receives a request and resolves locale, resource etc it delegates the request to controllers. Controller processes user request and populates model object with result and then represented the same to the user by the view. In some cases it invoke business logic or
As we all know Spring MVC framework is request driven. DispatcherServlet plays a major role in spring MVC framework. In spring MVC its an expression of “Front Controller” design pattern. DispatcherServlet is a simple servlet which gets defined in web.xml DispatcherServlet –> extends –> abstract FrameworkServlet –> extends –> abstract HttpServletBean –> extends –> javax.servlet.http.HttpServlet