Including JSP page into another JSP page, how to avoid multiple HEAD / BODY sections?

前端 未结 4 994
逝去的感伤
逝去的感伤 2021-01-14 13:17

I would like to include a JSP page into another JSP page. Let\'s say that I have master.jsp that is including slave.jsp.

As slave.jsp

4条回答
  •  难免孤独
    2021-01-14 13:57

    You could also extend the conditional option, and make a meta.jsp (for example), which contains a Map for each of the head elements - meta tags, css hrefs, script hrefs, and use the name of the jsp as a key in that Map. Then you call request.getRequestURI(), and show whatever you have put in the map under that key. Not a very beautiful solution, but working.

提交回复
热议问题