Please tell .jsp how to render individual static .jsp elements that are repeated in all pages. Suppose a header, menu, footer, etc. which are repeated, and so that you do not have to write them again, but simply call where I need to?

  • What? What does a separate item mean? - E1mir 6:26
  • I have a menu on the page which will be duplicated for many pages. Now I copy it to all pages. It’s not convenient. I want to take it out separately and paste it into the necessary pages.!)))) - Verlamov
  • Ahhh it) Got it) - E1mir

2 answers 2

In order not to repeat your menu every time, you need to create a separate .jsp file where it will be located, let’s say menu.jsp , and call it with such a command in another .jsp file by inserting such a simple line in the right place

 <%@ include file="menu.jsp" %> 

Here is a small example:

 <html> <head> <!--head--> </head> <body> <%@ include file="_menu.jsp" %> <h1>Hello world</h1> </body> </html> 
  • Need to write with <meta> <script> everything as usual? - Verlamov
  • @Verlamov I added a small example - E1mir 6:54
  • @KryTer_NexTFor example, thank you very much! did as in your example the error 500 takes off github.com/ArtyrGetman/platfor_sport/tree/verlamov/src/main/… - Verlamov
  • @Verlamov Hmm, weird ... I was fine, maybe the problem is most likely in the 'template' in which you call? - E1mir