I am using Spring and Apache Tiles (to manage my views). I have Controller class:
@Controller
@RequestMapping("/insurancecompany")
public class InsuranceCompanyController {
@Autowired
private InsuranceCompanyService insuranceCompanyService;
@RequestMapping("/create")
public ModelAndView createInsuranceCompany() {
ModelAndView mv = new ModelAndView();
mv.addObject("insuranceCompany", new InsuranceCompany());
return mv;
}
What should I write into Apache Tiles xml file to make it work? My xml file
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
"http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
<tiles-definitions>
<definition name="main.template" template="/WEB-INF/templates/maintemplate.jsp">
<put-attribute name="title" value="Welcome on my web app" />
<put-attribute name="menu" value="/WEB-INF/tiles/menu.jsp" />
<put-attribute name="body" value="" />
</definition>
...
<definition name="WHAT SHOULD BE HERE??" extends="main.template">
<put-attribute name="title" value="Insurance Company" />
<put-attribute name="body" value="/WEB-INF/tiles/createinsurancecompany.jsp" />
</definition>
</tiles-definitions>
I changed my controller class. I replace return type of my createInsuranceCompany method and now it returns String (unique name which is used in apache tiles xml file)
And my apache xml file looks like this