Well, I'm developing a website where the content is dynamically included.It's my first jsp project so I've got some - probably basic -questions. A jsp page is divided in some areas like content, navigation etc. Content -as an example - is dynamically included and should display some - I call them - blocks. A block is for example an image, a list and a headline. So content can have 1 to many blocks. So a page ->content->block->image I'm using the MVC pattern so my first approach was that my controller servlets passes to the jsp page an object called model and the jsp page gets the data out of it. Because of the structure this gets very ugly like: Page onepage = (Page) model.getPage(); and then (Area) onearea = (Area) onepage.getArea('content'); and so on... The second problem is how do I pass the needed objects to the includes..? Actually the jsp-page gets the object and writes it into the request with setAttribute and the included page pulls them out.. But this looks horrible.. Thanks for any advice!
The Struts and Tiles frameworks provide a commonly used solution for the situation you describe. These frameworks are getting to be ubiquitous, so I believe that it is worth your time to learn them. If you think about it, multiple developers with years of experience and tons of community feedback are probably going to have a better MVC solution than you come up with in a short amount of time by yourself (unless you happen to be Rod Johnson). Struts isn't perfect, but I think its much better than creating your own solution.
Thanks Anthony for the reply but unfortunately the project is advanced and we'd like to implement this on our own. By the way I think it's difficult to learn a technology and also an advanced framework in the same time But I hope someone can give me an advice how to design my approach..