Home » Tag Archives: Spring MVC (page 8)

Tag Archives: Spring MVC

Spring MVC REST Calls With Ajax

spring-interview-questions-answers

This post provides a simple example of REST calls to a Spring MVC web application. It is based on the Serving Static Resources With Spring MVC and Fetching JSON With Ajax In Spring MVC Context example. The code is  available on GitHub in the Spring-REST-With-Ajax directory. Main Page Our main page contains four buttons linked to Javascript functions performing Ajax calls:       ...

Read More »

Spring MVC Error Handling Example

spring-interview-questions-answers

This post describes the different techniques to perform error handling in Spring MVC 3. The code is available on GitHub in the Spring-MVC-Error-Handling directory. It is based on the Spring MVC With Annotations examples. Handling Exceptions Before Spring 3 Before Spring 3, exceptions were handled with HandlerExceptionResolvers. This interface defines a single method:       ModelAndView resolveException( HttpServletRequest request, HttpServletResponse response, Object ...

Read More »

Spring MVC Form Validation (With Annotations)

spring-interview-questions-answers

This post provides a simple example of a HTML form validation. It is based on the Spring MVC With Annotations example. The code is available on GitHub in the Spring-MVC-Form-Validation directory. Data For this example we will use a bean and JSR303 validation annotations:               public class MyUser { @NotNull @Size(min=1,max=20) private String name; @Min(0) @Max(120) private int ...

Read More »

Spring MVC for Atom Feeds

spring-interview-questions-answers

How to add feeds (Atom) to your web application with just two classes? How about Spring MVC? Here are my assumptions: you are using Spring framework you have some entity, say “News”, that you want to publish in your feeds your ‘News’ entity has creationDate, title, and shortDescription you have some repository/dao, say ‘NewsRepository’, that will return the news from ...

Read More »

Spring MVC Customized User Login Logout Implementation Example

spring-security-logo

This post describes how to implement a customized user access to an Spring MVC web application (login logout). As a prerequisite, readers are advised to read this post which introduces several Spring Security concepts. The code example is available from Github in the Spring-MVC-Login-Logout directory. It is derived from the Spring MVC with annotations example. Customized Authentication Provider In order ...

Read More »

Spring MVC Controller JUnit Testing

spring-interview-questions-answers

JUnit testing Spring MVC controllers is not an easy task. But recently, a new project (to be included in Spring soon) offers new tools to facilitate this. This post illustrates how to test a simple controller via JUnit tests. This code is a variation of the code used in JUnit Testing Spring Service and DAO (with In-Memory Database). It is ...

Read More »

Spring MVC 3 Template and Apache Tiles

spring-interview-questions-answers

An efficient design consideration for any web application is the use of a template engine (or tool), and with Spring’s “pluggable” nature, it is indeed much more easier to integrate template mechanisms such as Apache Tiles. In this simple post, I will give you a brief intro and basics of using Tiles as a Template engine for your Web Application! ...

Read More »

Spring – Adding Spring MVC – part 2

spring-interview-questions-answers

In the previous part we’ve implemented controllers for managers and employees. Now that we know our way around, we’ll do little (but just little) more complicated stuff – controllers for tasks & timesheets. So let’s start with org.timesheet.web.TaskController. First create a class and this time we will be accessing richer domain, so we’ll need to autowire three DAOS – for ...

Read More »

Spring – Adding Spring MVC – part 1

spring-interview-questions-answers

Welcome to the fourth part of this tutorial. In this part, we will write controllers and views using Spring MVC and think about our REST model. First thing that we must do, is make a web application from what we have so far. We will add web/WEB-INF folder to our project root. Inside WEB-INF create jsp folder. We will put ...

Read More »

Maven Web Project Kickstarter Codebase with Spring, Hibernate, Akka, Twitter Bootstrap, Apache Tiles and jQuery

akka-logo

I am happy to upload my second project to GitHub to help people get started with Java Web App Development as quickly as possible. I am sharing this code with Apache License 2.0. Here is the URL for the same: https://github.com/ykameshrao/spring-hibernate-springdata-springmvc-maven-project-framework The project consists of following parts: 1) Commons-Deps: Dependencies declared as a single pom file to easily manage the ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.