GeeCON Prague 2014*
The moose likes JSP and the fly likes include duplicate issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "include duplicate issue" Watch "include duplicate issue" New topic
Author

include duplicate issue

Mike Spenser
Greenhorn

Joined: Jun 13, 2006
Posts: 21
General question about how <@include ... %> and <jsp:include ... /> work.

if say for example I had a header defined as

<html><body><h1>TEXT</h1></body></html>

and then in my main page
<html><body>

[@inclue or jsp:include]

<p>some body text here</p>

</body></html>

won't that duplicate the html? since, in the case of @include its akin to a C MACRO or a straight up copy-and-paste?

is the correct way to do this to strip the offending tags (the HTML and BODY in my example) or does jsp:include do some magic to strip out the unwanted ones?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

Why are they there in the first place? Why does the header have html tags and the body too? It's your reponsibility to make sure that the HTML is well formed.

And no, there is no magic to the include mechanism. To all JSP mechanisms HTML is just template text with no semantics applied.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mike Spenser
Greenhorn

Joined: Jun 13, 2006
Posts: 21
thanks, makes sense
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

Perhaps this article might be of interest.
 
GeeCON Prague 2014
 
subject: include duplicate issue