Spring 3 MVC Tiles Plugin with Example

In this Chapter we will discuss about the tiles and build a simple Spring3MVC  application that utilizes templates using the Apache Tile 3 framework. Now we will create a template version of our pages, and compare it with non-template versions of the same pages. We will split the content, style, and template of these pages logically.

What is Apache Tiles 3.0.1?
Apache Tiles is a templating framework built to simplify the development of web application user interfaces.

Apache Tiles is a popular and mostly used templating framework for java based web application. Tiles became more popular because Struts 1.x uses Tiles as its default templating framework. Spring3MVC which is an MVC framework, like Struts, also supports integration of Tiles as its templating framework.

Tiles allows developer to define page fragments(or parts) which can be assembled into a complete page at run-time. These fragments, or tiles, can be used as simple includes in order to reduce the duplication of common page elements or embedded within other tiles to develop a series of reusable templates. These templates streamline the development of a consistent look and feel across an entire application.


Let us see how we can integrate Spring3MVC and Tiles.
You can download Tiles binaries from here

Application Layout


A web portal have many reusable templates like header, footer, menu etc. These elements remains same in every web page to give a uniform feel and look to improve presentation of portal. But difficult part is when you need to alter these common items.
 

The Tiles framework solve this problem by using templatization mechanism. We create a common Header, Footer, Menu page and include this in each page. A common layout of website is defined in a central configuration file and this layout can be extended across all the web pages of the web application.

Add the following required tiles jars to WEB-INF/lib folder.
  • tiles-api-2.2.2.jar
  • tiles-core-2.2.2.jar
  • tiles-jsp-2.2.2.jar
  • tiles-servlet-2.2.2.jar
  • tiles-template-2.2.2.jar
In the previous chapter we run an application of CRUD operation on the Employee table using Spring3MVC and Hibernate3. Now same we will build same application using tiles configuration (or Tiles View Resolver) as view in stead of JstlView (or JSP View resolver).
Updated view of our application with using the tiles configuration look like as below diagram.
Application Structure:

EmployeeBean.java
  1. package com.dineshonjava.bean;  
  2.   
  3. /** 
  4.  * @author Dinesh Rajput 
  5.  * 
  6.  */  
  7. public class EmployeeBean {  
  8.  private Integer id;  
  9.  private String name;  
  10.  private Integer age;  
  11.  private Long salary;  
  12.  private String address;  
  13.    
  14.  public Long getSalary() {  
  15.   return salary;  
  16.  }  
  17.  public void setSalary(Long salary) {  
  18.   this.salary = salary;  
  19.  }  
  20.  public Integer getId() {  
  21.   return id;  
  22.  }  
  23.  public void setId(Integer id) {  
  24.   this.id = id;  
  25.  }  
  26.  public String getName() {  
  27.   return name;  
  28.  }  
  29.  public void setName(String name) {  
  30.   this.name = name;  
  31.  }  
  32.  public Integer getAge() {  
  33.   return age;  
  34.  }  
  35.  public void setAge(Integer age) {  
  36.   this.age = age;  
  37.  }  
  38.  public String getAddress() {  
  39.   return address;  
  40.  }  
  41.  public void setAddress(String address) {  
  42.   this.address = address;  
  43.  }  
  44. }  
Employee.java
  1. package com.dineshonjava.model;  
  2.   
  3. import java.io.Serializable;  
  4.   
  5. import javax.persistence.Column;  
  6. import javax.persistence.Entity;  
  7. import javax.persistence.GeneratedValue;  
  8. import javax.persistence.GenerationType;  
  9. import javax.persistence.Id;  
  10. import javax.persistence.Table;  
  11.   
  12. /** 
  13.  * @author Dinesh Rajput 
  14.  * 
  15.  */  
  16. @Entity  
  17. @Table(name="Employee")  
  18. public class Employee implements Serializable{  
  19.   
  20.  private static final long serialVersionUID = -723583058586873479L;  
  21.    
  22.  @Id  
  23.  @GeneratedValue(strategy=GenerationType.AUTO)  
  24.  @Column(name = "empid")  
  25.  private Integer empId;  
  26.    
  27.  @Column(name="empname")  
  28.  private String empName;  
  29.    
  30.  @Column(name="empaddress")  
  31.  private String empAddress;  
  32.    
  33.  @Column(name="salary")  
  34.  private Long salary;  
  35.    
  36.  @Column(name="empAge")  
  37.  private Integer empAge;  
  38.   
  39.  public Integer getEmpId() {  
  40.   return empId;  
  41.  }  
  42.   
  43.  public void setEmpId(Integer empId) {  
  44.   this.empId = empId;  
  45.  }  
  46.   
  47.  public String getEmpName() {  
  48.   return empName;  
  49.  }  
  50.   
  51.  public void setEmpName(String empName) {  
  52.   this.empName = empName;  
  53.  }  
  54.   
  55.  public String getEmpAddress() {  
  56.   return empAddress;  
  57.  }  
  58.   
  59.  public void setEmpAddress(String empAddress) {  
  60.   this.empAddress = empAddress;  
  61.  }  
  62.   
  63.  public Long getSalary() {  
  64.   return salary;  
  65.  }  
  66.   
  67.  public void setSalary(Long salary) {  
  68.   this.salary = salary;  
  69.  }  
  70.   
  71.  public Integer getEmpAge() {  
  72.   return empAge;  
  73.  }  
  74.   
  75.  public void setEmpAge(Integer empAge) {  
  76.   this.empAge = empAge;  
  77.  }  
  78. }  
EmployeeDao.java
  1. package com.dineshonjava.dao;  
  2.   
  3. import java.util.List;  
  4.   
  5. import com.dineshonjava.model.Employee;  
  6.   
  7. /** 
  8.  * @author Dinesh Rajput 
  9.  * 
  10.  */  
  11. public interface EmployeeDao {  
  12.    
  13.  public void addEmployee(Employee employee);  
  14.   
  15.  public List<Employee> listEmployeess();  
  16.    
  17.  public Employee getEmployee(int empid);  
  18.    
  19.  public void deleteEmployee(Employee employee);  
  20. }  
EmployeeDaoImpl.java
  1. package com.dineshonjava.dao;  
  2.   
  3. import java.util.List;  
  4.   
  5. import org.hibernate.SessionFactory;  
  6. import org.springframework.beans.factory.annotation.Autowired;  
  7. import org.springframework.stereotype.Repository;  
  8.   
  9. import com.dineshonjava.model.Employee;  
  10.   
  11. /** 
  12.  * @author Dinesh Rajput 
  13.  * 
  14.  */  
  15. @Repository("employeeDao")  
  16. public class EmployeeDaoImpl implements EmployeeDao {  
  17.   
  18.  @Autowired  
  19.  private SessionFactory sessionFactory;  
  20.    
  21.  public void addEmployee(Employee employee) {  
  22.    sessionFactory.getCurrentSession().saveOrUpdate(employee);  
  23.  }  
  24.   
  25.  @SuppressWarnings("unchecked")  
  26.  public List<Employee> listEmployeess() {  
  27.   return (List<Employee>) sessionFactory.getCurrentSession().createCriteria(Employee.class).list();  
  28.  }  
  29.   
  30.  public Employee getEmployee(int empid) {  
  31.   return (Employee) sessionFactory.getCurrentSession().get(Employee.class, empid);  
  32.  }  
  33.   
  34.  public void deleteEmployee(Employee employee) {  
  35.   sessionFactory.getCurrentSession().createQuery("DELETE FROM Employee WHERE empid = "+employee.getEmpId()).executeUpdate();  
  36.  }  
  37. }<span style="color: #4c1130;"><b>  
  38. </b></span>  
EmployeeService.java
  1. package com.dineshonjava.service;  
  2.   
  3. import java.util.List;  
  4.   
  5. import com.dineshonjava.model.Employee;  
  6.   
  7. /** 
  8.  * @author Dinesh Rajput 
  9.  * 
  10.  */  
  11. public interface EmployeeService {  
  12.    
  13.  public void addEmployee(Employee employee);  
  14.   
  15.  public List<Employee> listEmployeess();  
  16.    
  17.  public Employee getEmployee(int empid);  
  18.    
  19.  public void deleteEmployee(Employee employee);  
  20. }  
EmployeeServiceImpl.java
  1. package com.dineshonjava.service;  
  2.   
  3. import java.util.List;  
  4.   
  5. import org.springframework.beans.factory.annotation.Autowired;  
  6. import org.springframework.stereotype.Service;  
  7. import org.springframework.transaction.annotation.Propagation;  
  8. import org.springframework.transaction.annotation.Transactional;  
  9.   
  10. import com.dineshonjava.dao.EmployeeDao;  
  11. import com.dineshonjava.model.Employee;  
  12.   
  13. /** 
  14.  * @author Dinesh Rajput 
  15.  * 
  16.  */  
  17. @Service("employeeService")  
  18. @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)  
  19. public class EmployeeServiceImpl implements EmployeeService {  
  20.   
  21.  @Autowired  
  22.  private EmployeeDao employeeDao;  
  23.    
  24.  @Transactional(propagation = Propagation.REQUIRED, readOnly = false)  
  25.  public void addEmployee(Employee employee) {  
  26.   employeeDao.addEmployee(employee);  
  27.  }  
  28.    
  29.  public List<Employee> listEmployeess() {  
  30.   return employeeDao.listEmployeess();  
  31.  }  
  32.   
  33.  public Employee getEmployee(int empid) {  
  34.   return employeeDao.getEmployee(empid);  
  35.  }  
  36.    
  37.  public void deleteEmployee(Employee employee) {  
  38.   employeeDao.deleteEmployee(employee);  
  39.  }  
  40.   
  41. }  
EmployeeController.java
  1. package com.dineshonjava.controller;  
  2.   
  3. import java.util.ArrayList;  
  4. import java.util.HashMap;  
  5. import java.util.List;  
  6. import java.util.Map;  
  7.   
  8. import org.springframework.beans.factory.annotation.Autowired;  
  9. import org.springframework.stereotype.Controller;  
  10. import org.springframework.validation.BindingResult;  
  11. import org.springframework.web.bind.annotation.ModelAttribute;  
  12. import org.springframework.web.bind.annotation.RequestMapping;  
  13. import org.springframework.web.bind.annotation.RequestMethod;  
  14. import org.springframework.web.servlet.ModelAndView;  
  15.   
  16. import com.dineshonjava.bean.EmployeeBean;  
  17. import com.dineshonjava.model.Employee;  
  18. import com.dineshonjava.service.EmployeeService;  
  19.   
  20. /** 
  21.  * @author Dinesh Rajput 
  22.  * 
  23.  */  
  24. @Controller  
  25. public class EmployeeController {  
  26.    
  27.  @Autowired  
  28.  private EmployeeService employeeService;  
  29.    
  30. @RequestMapping(value = "/save", method = RequestMethod.POST)  
  31. public ModelAndView saveEmployee(@ModelAttribute("command")EmployeeBean employeeBean,   
  32.    BindingResult result) {  
  33.   Employee employee = prepareModel(employeeBean);  
  34.   employeeService.addEmployee(employee);  
  35.   return new ModelAndView("redirect:/add.html");  
  36.  }  
  37.   
  38.  @RequestMapping(value="/employees", method = RequestMethod.GET)  
  39.  public ModelAndView listEmployees() {  
  40.   Map<String, Object> model = new HashMap<String, Object>();  
  41.   model.put("employees",  prepareListofBean(employeeService.listEmployeess()));  
  42.   return new ModelAndView("employeesList", model);  
  43.  }  
  44.   
  45.  @RequestMapping(value = "/add", method = RequestMethod.GET)  
  46.  public ModelAndView addEmployee(@ModelAttribute("command")EmployeeBean employeeBean,  
  47.    BindingResult result) {  
  48.   Map<String, Object> model = new HashMap<String, Object>();  
  49.   model.put("employees",  prepareListofBean(employeeService.listEmployeess()));  
  50.   return new ModelAndView("addEmployee", model);  
  51.  }  
  52.    
  53. @RequestMapping(value = "/index", method = RequestMethod.GET)  
  54. public ModelAndView welcome() {  
  55.   return new ModelAndView("redirect:/add.html");  
  56.  }  
  57.   
  58. @RequestMapping(value = "/delete", method = RequestMethod.GET)  
  59. public ModelAndView editEmployee(@ModelAttribute("command")EmployeeBean employeeBean,  
  60.    BindingResult result) {  
  61.   employeeService.deleteEmployee(prepareModel(employeeBean));  
  62.   Map<String, Object> model = new HashMap<String, Object>();  
  63.   model.put("employee"null);  
  64.   model.put("employees",  prepareListofBean(employeeService.listEmployeess()));  
  65.   return new ModelAndView("addEmployee", model);  
  66.  }  
  67.    
  68. @RequestMapping(value = "/edit", method = RequestMethod.GET)  
  69. public ModelAndView deleteEmployee(@ModelAttribute("command")EmployeeBean employeeBean,  
  70.    BindingResult result) {  
  71.   Map<String, Object> model = new HashMap<String, Object>();  
  72.   model.put("employee", prepareEmployeeBean(employeeService.getEmployee(employeeBean.getId())));  
  73.   model.put("employees",  prepareListofBean(employeeService.listEmployeess()));  
  74.   return new ModelAndView("addEmployee", model);  
  75.  }  
  76.    
  77.  private Employee prepareModel(EmployeeBean employeeBean){  
  78.   Employee employee = new Employee();  
  79.   employee.setEmpAddress(employeeBean.getAddress());  
  80.   employee.setEmpAge(employeeBean.getAge());  
  81.   employee.setEmpName(employeeBean.getName());  
  82.   employee.setSalary(employeeBean.getSalary());  
  83.   employee.setEmpId(employeeBean.getId());  
  84.   employeeBean.setId(null);  
  85.   return employee;  
  86.  }  
  87.    
  88.  private List<EmployeeBean> prepareListofBean(List<Employee> employees){  
  89.   List<employeebean> beans = null;  
  90.   if(employees != null && !employees.isEmpty()){  
  91.    beans = new ArrayList<EmployeeBean>();  
  92.    EmployeeBean bean = null;  
  93.    for(Employee employee : employees){  
  94.     bean = new EmployeeBean();  
  95.     bean.setName(employee.getEmpName());  
  96.     bean.setId(employee.getEmpId());  
  97.     bean.setAddress(employee.getEmpAddress());  
  98.     bean.setSalary(employee.getSalary());  
  99.     bean.setAge(employee.getEmpAge());  
  100.     beans.add(bean);  
  101.    }  
  102.   }  
  103.   return beans;  
  104.  }  
  105.    
  106.  private EmployeeBean prepareEmployeeBean(Employee employee){  
  107.   EmployeeBean bean = new EmployeeBean();  
  108.   bean.setAddress(employee.getEmpAddress());  
  109.   bean.setAge(employee.getEmpAge());  
  110.   bean.setName(employee.getEmpName());  
  111.   bean.setSalary(employee.getSalary());  
  112.   bean.setId(employee.getEmpId());  
  113.   return bean;  
  114.  }  
  115. }  
Spring Web configuration file web.xml


   
     sdnext
     org.springframework.web.servlet.DispatcherServlet
     
            contextConfigLocation/WEB-INF/config/sdnext-servlet.xml
     1
   

 
  sdnext
  *.html
 

 
  index.html
 


Spring Web configuration file sdnext-servlet.xml











	

    
	
	    org.springframework.web.servlet.view.tiles2.TilesView
	
     


    
	 
	     /WEB-INF/config/tiles.xml
	 
      



 
 
 
 



 
 
  
   com.dineshonjava.model.Employee
  
 
 
 
  ${hibernate.dialect}
  ${hibernate.show_sql}
  ${hibernate.hbm2ddl.auto}      
        
      


  
 
  

tiles.xml

    
        
        
        
        
        
    
 
    
        
        
    
    
    
        
        
    
 

database.properties
database.driver=com.mysql.jdbc.Driver
database.url=jdbc:mysql://localhost:3306/DAVDB
database.user=root
database.password=root
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=true
hibernate.hbm2ddl.auto=update
addEmployee.jsp
  1. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"  
  2.     pageEncoding="ISO-8859-1"%>  
  3. <%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>  
  4. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>  
  5.   
  6. <html>  
  7.  <head>  
  8.     
  9.   <title>Spring MVC Form Handling</title>  
  10.  </head>  
  11.  <body>  
  12.   <h2>Add Employee Data</h2>  
  13. <form:form action="/sdnext/save.html" method="POST">       
  14.   <table>
  15.    <tbody>  
  16.       <tr>          
  17.         <td><form:label path="id">Employee ID:</form:label></td>
  18.           <td><form:input path="id" readonly="true" value="${employee.id}"> 
  19.           </form:input></td>
  20.       </tr>  
  21.       <tr>  
  22.          <td><form:label path="name">Employee Name:</form:label></td> 
  23.         <td><form:input path="name" value="${employee.name}">   
  24.          </form:input></td> 
  25.      </tr>  
  26.      <tr>
  27.        <td><form:label path="age">Employee Age:</form:label></td> 
  28.        <td><form:input path="age" value="${employee.age}">
  29.        </form:input></td> 
  30.      </tr>  
  31.      <tr> 
  32.         <td><form:label path="salary">Employee Salary:</form:label></td> 
  33.         <td><form:input path="salary" value="${employee.salary}">
  34.          </form:input></td>
  35.      </tr>  
  36.      <tr> 
  37.         <td><form:label path="address">Employee Address:</form:label></td> 
  38.         <td><form:input path="address" value="${employee.address}">
  39.          </form:input></td> 
  40.      </tr>  
  41.     <tr> 
  42.         <td colspan="2"> 
  43.           <input type="submit" value="Submit"></td> 
  44.      </tr>  
  45.    </tbody> 
  46.   </table>  
  47. </form:form>    
  48.   <c:if test="${!empty employees}">  
  49.    <h2>  List Employees</h2>  
  50.  <table align="left" border="1"> 
  51.    <tbody> 
  52.      <tr> 
  53.         <th>Employee ID</th> 
  54.         <th>Employee Name</th> 
  55.         <th>Employee Age</th>
  56.         <th>Employee Salary</th> 
  57.         <th>Employee Address</th> 
  58.         <th>Actions on Row</th> 
  59.    </tr>  
  60. <c:foreach items="${employees}" var="employee">
  61.  <tr> 
  62.     <td><c:out value="${employee.id}"></c:out> 
  63. </td>
  64.       <td><c:out value="${employee.name}"></c:out>
  65.  </td> 
  66.      <td><c:out value="${employee.age}"></c:out>
  67.  </td>
  68.       <td><c:out value="${employee.salary}"></c:out> 
  69. </td> 
  70.      <td><c:out value="${employee.address}"></c:out>
  71.  </td>
  72.       <td align="center"><a href="edit.html/?id=${employee.id}">Edit</a> |  
  73.      <a href="delete.html/?id=${employee.id}">Delete</a> 
  74.    </td> 
  75.    </tr> 
  76. </c:foreach>
  77.  
  78. </tbody></table>  
  79. </c:if>  
  80.  </body>  
  81. </html>  
employeesList.jsp
  1. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"  
  2.     pageEncoding="ISO-8859-1"%>  
  3. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>  
  4.   
  5. <html>  
  6. <head>  
  7. <title>All Employees</title>  
  8. </head>  
  9. <body>  
  10. <h1>  
  11. List Employees</h1>  
  12. <h3>  
  13. <a href="http://add.html/">Add More Employee</a></h3>  
  14. <c:if test="${!empty employees}">  
  15.  
  16. <table align="left" border="1"> 
  17. <tbody>  
  18. <tr> 
  19.     <th>Employee ID</th> 
  20.     <th>Employee Name</th> 
  21.     <th>Employee Age</th> 
  22.     <th>Employee Salary</th> 
  23.     <th>Employee Address</th>
  24.     </tr>  
  25. <c:foreach items="${employees}" var="employee"> 
  26. <tr> 
  27.      <td><c:out value="${employee.id}"></c:out>
  28.  </td> 
  29.      <td><c:out value="${employee.name}"></c:out> 
  30. </td> 
  31.      <td><c:out value="${employee.age}"></c:out> 
  32. </td>
  33.       <td><c:out value="${employee.salary}"></c:out> 
  34. </td> 
  35.      <td><c:out value="${employee.address}"></c:out></td> 
  36.   </tr>  
  37. </c:foreach>
  38. </tbody>
  39.  </table>  
  40. </c:if>  
  41. </body>  
  42. </html>  
menu.jsp
  1.   <h2>  Menu</h2>  
  2. 1. <a href="employees.html">List of Employees</a> 
  3. 2. <a href="add.html">Add Employee</a>
header.jsp
  1. <h2>Header- Employee Management System</h2>
footer.jsp
  1.  
  2.     <p>Copyright &copy; 2013 dineshonjava.com</p> 
mainTemplate.jsp
  1. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"  
  2.     pageEncoding="ISO-8859-1"%>  
  3.   
  4. <html>  
  5.   <head>  
  6.       
  7.     <title>
        <tiles:insertAttribute name="title" ignore="true"></tiles:insertAttribute>
    </title>
    </head>
    <body>
    <table border="1" cellpadding="2" cellspacing="2" align="left">
        <tr>
            <td colspan="2" align="center">
                <tiles:insertAttribute name="header"></tiles:insertAttribute>
            </td>
        </tr>
        <tr>
            <td>
                <tiles:insertAttribute name="menu"></tiles:insertAttribute>
            </td>
            <td>
                <tiles:insertAttribute name="body"></tiles:insertAttribute>
            </td>
        </tr>
        <tr>
            <td colspan="2"  align="center">
                <tiles:insertAttribute name="footer"></tiles:insertAttribute>
            </td>
        </tr>
    </table>
  8. </body>  
  9. </html>


Once you are done with creating source and configuration files, export your application. Right click on your application and use Export-> WAR File option and save your Spring3TilesApp.war file in Tomcat's webapps folder.

Now start your Tomcat server and make sure you are able to access other web pages from webapps folder using a standard browser. Now try a URL http://localhost:8080/sdnext/ and you should see the following result if everything is fine with your Spring Web Application:
 Now we click on the List of Employee link on the Menu section then we get the following output screen we observe that only body of the mainTemplate is refreshed.

Dwonload this Application SourceCode+Libs

Spring3TilesApp.zip

   <<Spring Web MVC Framework |index| Spring 3 MVC Framework with Interceptor>> 

20 comments:

  1. I am using sts to import the download of your zip file, but can't import? what can I do to open your samplefile? Thanks

    ReplyDelete
    Replies
    1. Hi,

      Please do unzip and then import project to the workspace.

      Thanks
      Dinesh

      Delete
  2. hey very very thanks dude.. You did a very good job

    ReplyDelete
  3. hey thanks dude.. It is very nyc article.. It helped me a lot. There is a small correction in
    addEmployee.jsp in \ tag
    change action attribute action="save.html".

    ReplyDelete
    Replies
    1. Thanks Naga Praveen for this correction.

      Delete
  4. thanks dinesh excellent tutorials..........

    ReplyDelete
  5. such a great tutorial, i had never seen
    thank you
    regards
    Ganga

    ReplyDelete
    Replies
    1. Thanks Ganga for nice compliment...keep learning with us :)

      Thanks,
      Dinesh

      Delete
  6. hello dinesh, im using user tutorials for my Education and got a huge advantage from your lessons,
    now i have error in my project, i interact several JSP files with your application, all Tiles configurations are correct, but i got this error "javax.servlet.ServletException: Could not resolve view with name 'Depo' in servlet with name 'spring' " , inside the controller ModelAndView not return, but i add working JSP page to my ModelAndView its works, now im very confuse, how to resolve this error, can you give same idea..

    "
    @RequestMapping(value = "/transformerAdd.do", method = RequestMethod.GET)
    public ModelAndView setTransformer(Map map) {
    ModelAndView model=new ModelAndView("EmployeeAdd2");


    System.out.println("------------- Transformer-----------");
    return model;
    }
    "
    System.out.println also display...

    ReplyDelete
    Replies
    1. Hi,
      Could you share please your application as a zip at admin@dineshonjava.com so we ca help you properly.

      Thanks,
      Anamika

      Delete
  7. this is a controller
    "@RequestMapping(value = "/depoAdd.do", method = RequestMethod.GET)
    public ModelAndView setDepo(Map map) {
    ModelAndView model=new ModelAndView("Depo");


    System.out.println("------------- d-----------");
    return model;
    }"

    ReplyDelete
  8. Thank you very much. It is very interesting. But i have an exception
    java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

    Although, the username/password and db name are correctly configured
    Could you help me please ?
    Thank you in advanced.

    ReplyDelete
    Replies
    1. Hi Friends,

      Please update database.properties file where we are using database username and password.
      Use password whatever you used in your machine. And redeploy again.

      Thanks
      Dinesh Rajput

      Delete
  9. Its really nice tutorial for Spring beginners.......thanks doj...

    ReplyDelete
  10. hi i cannot able to download your profile.........
    what is the problem......?

    ReplyDelete
    Replies
    1. Hi Harish,

      Could please tell me what is problem to download the source code of this application.

      Delete