I am switching my project from CodeIgniter to Spring.
The thing I can do in CodeIgniter is load multiple views in sequence and create a new view.
For example let's say that everything inside my <head>
tag is going to be identical across all the pages with exception of <title>
. I could simply do $this->load->view('header', $header_data);
where header
represents the view name, and $header_data
represents an array which contains value for the title.
In Spring however my controller does the following
@Controller
@RequestMapping("/")
public class IndexController
{
@RequestMapping(method = RequestMethod.GET)
public String index(ModelMap model)
{
model.addAttribute("title", "Home");
return "index";
}
}
It does not seem like I can load header, body, and footer separately like I could with php, and I can't pass different variables into each separate view.
Is there any way I could do this in spring? Any example, or a link will be greatly appreciated.
Aucun commentaire:
Enregistrer un commentaire