Dec 23rd, 2010, 11:03 AM
How do I create dynamic pages? (Partials from Rails)
This may seem like a stupid question but I'm new to Spring and I want to do what I can do so easily in Rails.
Let me explain in "Rails terms" then hopefully I can ask intelligently enough for Java/Spring.
In Rails I have a main layout template called "application.html.erb".
Within that file there is a <%= yield %> tag so that if I choose to render another view (such as customers), the tag "yield" will be replaced by the customers view.
I tried to do this using Tiles 2. I found a few tutorials but NONE of them work. I have the simplest Spring MVC web app I can think of. I can post all of the code if needed.
I really don't care if I use Tiles 2. I just need that functionality. It's insane to have all of my JSP files containing the same HTML text (headers, etc).
One option I thought of would be to use static JSP fragments for things like menus and headers. This is probably the way I will go if I can't get some type of dynamic rendering going.
Thanks for any help.
Dec 23rd, 2010, 11:52 AM
I use static jsp to define hearders, footers, and menus.
Personally, I think tiles 2 cannot handle pages created on the fly..
Maybe you can take a look of the preparer of tiles 2. I haven't used preparers. So I am not sure whether that can help or not.
Tags for this Thread