Last week questions about the handling of frames with MVC came up in the forum. Furthermore one of my colleagues also asked questions about frames so I decided to write this weblog. It doesn’t feature a complete example application but simply shows the basic ideas and techniques.
h2. The Task
Most internet users are used to a basic website layout. There is a menu on the top or the left and another area where all the contents will be displayed. As pragmatic programmers we do not want to repeat ourselves so we put the menu in one frame and the sites which the user requests are shown in the other frame so that the menu has to be created only once. Now, the question is how can we achieve a similar layout using MVC?
h2. Layout using html frames
If you want to build a layout like the one displayed above you need:
- A page with a frameset and two frames
- The pages that will be displayed in the frames
h2. Layout using Controller and passing the view-name as a parameter