How should I structure my website to minimize multiple page editing?

I am developing a small website using HTML + JSP.

This is my first experience using JSP, although I previously used PHP to create pages. One thing I found is that when I was making separate pages, I copied + pasted the site layout code onto each page, and then added the content. This seems extremely inferior, and I was wondering what is the most common practice for this?

One of my ideas was to have the main page index.jsp containing the layout code, and then use GET to pass the new page to index.jsp. Therefore, to go to the Products page, you must type index.jsp? Page = products, and the case file in the index.jsp file will print the correct content.

I am new to web design, so I would be very grateful for any information or links on this topic.

+3
source share
5 answers

The usual (and simple) approach is to break up your HTML into sections of the boards (header, footer, sidebar, etc.). Then you put these sections in your own .jsp file and include them on all pages:

  • header.jsp:
  • footer.jsp:
  • sidebar.jsp:

, - , .jsp, .

+3

, . , , SiteMesh. SiteMesh, , , YMMV.

+1

Java ( JSP) .

JSP, (- ), , Struts. , , .

"Struts-tiles", , .

+1

- -, , . , , . Struts.

, , , . - java .

Copy-Paste . .

+1

Source: https://habr.com/ru/post/1754988/


All Articles