Hey guys,
I'm currently learning JSP and Java using Netbeans, and I was wondering if there was an easy way to create a web template layout. For example, using a single header, footer, and navigation bar for all pages. In Ruby on Rails, there is a "layouts" view, which you can define an .rhtml page and simply put the yield tag, <%= yield %> . Once this is done, all of the views you create will simply append the layout where the yield tag is. Is there something similar to this that I can use for a Java Web App?

Thanks,
- Jeff Miller

If you are familiar with struts then try to use tiles.

> Is there something similar to this that I can use for a Java Web App?

Yes, you can either use the <jsp:include> standard action or tag files to include reusable view templates in your web pages.

Edit: Just keep in mind that the above mentioned techniques include the content at runtime. If you are pretty sure that your re-usable views would never host dynamic content, go with the include directive which includes the content at translation time as opposed to run-time.

commented: Good suggestion. +6
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.