How to use multiple controller or how properly use Apache Tiles?

103 views Asked by At

I make website by Spring MVC and have few questions:

  1. For presented the view I use Apache Tiles tool. Is it a good idea or is there better ways?

  2. There are body and rightsidebar in my website structure. For secure I use the Spring Security. And i want implement some view that will show for example in body users list and in sidebar authentication form. But on another page it will show another data, like for example some image from data base in body and user profile in sidebar.

Are there some advises?

1

There are 1 answers

0
Neil McGuigan On BEST ANSWER

I'd recommend SiteMesh (2.4) over Tiles, as Tiles has some limitations, such as changing the page title or meta tags from a view.

For multiple pages, you will want multiple URLs, and usually one Controller per page. You could use one controller, but I'd suggest using one controller per page.

For example, you could have a users page at /users, and a UserController that mapped to the /users URL. This would load the user data and tell Spring to use the "users.jsp" view.

You can also have an images page at /images, and an ImageController that mapped to the /images URL.