Home » spring » Page 16

Tag Archives: spring

Spring JUnit Test Example

In this example, I’ll be showcasing how to do Unit Tests for Spring beans using only annotations. 1. Introduction Spring has its own testing framework for all objects created under its IOC container (that we all know is just the JVM instance). Spring has created its own paradigm of object creation and destruction and it made sense for it to ...

Read More »

Generating Database Objects from Hibernate Entities

In the usual scenario, developers will tend to create database objects first before the entities. This is called bottom to top approach. You start with creating your bottom (database) and create all the way up to the top (java). It’s beneficial of course, since you usually plan the data flow before you even create the services so that you can ...

Read More »

Hibernate validator example

This is an example of how to make use of Hibernate validator API. Hibernate validator can be used to validate data, which is a very important issue in every layer of an application. For example, validating is important when submitting HTML forms. Hibernate validator framework provides many annotations, that can be used to validate input fields of a form against ...

Read More »

Spring MVC Form Handling Example

With this tutorial we shall explain create and submit a form in Spring MVC. Spring MVC provides tags that are data binding-aware and allow us to handle form elements, compining JSP and Spring Web MVC. Each tag in Spring MVC provides support for the set of attributes of its corresponding HTML tag, thus making the tags familiar and intuitive to ...

Read More »

Spring MVC File Upload Example

With this tutorial we shall explain how to provide users the option to upload a file, inside a form in Spring MVC. When creating and submitting a form, it is very common need to upload a file during the form submission. This can be achieved very easily, with the use of Spring MVC API. This example contains a simple class, ...

Read More »

Spring MVC Form Errors Tag Example

In this example we will show you how to display error messages when submitting a form in Spring MVC. The tag provided by Spring MVC is errors tag. The errors tag renders field errors in an HTML span tag. It provides access to the errors that are created in the Controller or the Validators used. Here, we will create a ...

Read More »

Spring MVC Hidden Value Example

This is an example of how to make use of a hidden value in Spring MVC. Spring MVC provides tags that are very similar to HTML tags and can offer the same functionality. When creating a form, there is sometimes a need to keep a value in a view and use it in a next step, without making it visible ...

Read More »

Spring MVC Dropdown Box Example

With this example we shall show you how to create a dropdown box using Spring MVC. Spring MVC provides us with tags similar to HTML tags in functionality. In order to make use of a dropdown box, in Spring MVC, we are going to use the options tag. This tag renders a list of HTML option tags and sets the ...

Read More »

Spring MVC Radiobutton And Radiobuttons Example

This is a simple example of how to use the radiobutton and radiobuttons tags in Spring MVC. Among the most famous HTML tags is the radio button tag, that renders one or multiple HTML input tags with type radio. The radiobutton and radiobuttons tags are pretty similar to the HTML radio button tag and they are very easy to use, ...

Read More »

Spring MVC Checkbox And Checkboxes Example

This is a simple example of how to create a checkbox and a checkboxes tag in Spring MVC. Among the most famous HTML tags is the checkbox tag, that allows users to check one or more values in a form. Spring MVC checkbox and checkboxes tags are pretty similar to the HTML checkbox tag and they are very easy to ...

Read More »