I'm learning JSP and have a good working knowledge of PHP and MVC frameworks.
I would like to know how I can break down JSP files so that I can have a file for the header, with the doctype/meta/references stuff, a file for the footer with the closing body and html tags etc, and a file for the menu (these sections will be the same on every page so I don't want to duplicate them, otherwise updating will take ages).
In PHP I would just include the file for each.
How does this work for JSP, and is there a best practise?
Doing this stuff manually is messy. Try Apache Tiles or Sitemesh .
I agree with what Matt said in his comment, but if you really want to do included JSP files using
<jsp:include page="<yourfile>"/>
works about how you'd expect, where yourfile is either an actual path to a specific file, or a file in the same directory.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.