• Post Reply Bookmark Topic Watch Topic
  • New Topic

[JSP] putting every repetitive parts into the header

 
Csaba Szegedi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm trying to avoid the redundant parts of the webpages by using a header.jsp

Unfortunately, including the tag libraries into the header.jsp can't take effect just included page by page
I would like to use them

Is there any way to putting them into the header.jsp to make them accessible ?
There are several another kind of part can be placed here as follow:

Is there any golden rule ?

Thanks in advance

csaba







 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the include action causes the "sub" JSP to be evaluated on its own. Any directives within it, are confined to the sub-JSP.

If your intent is to include the directives in the main JSP, you want to use the include directive instead of the action.

If your intent is to just include something at the head (or tail) of each and every JSP, look into defining a prelude (or a coda).
 
Csaba Szegedi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Bear,

I used the include directive (as you mention in the 1. case) to make the header content accessible.
It's not clear for me what did I wrong.(I included the header into the main page with jsp:include, but I could not access eg. stripes tags)
Can you show me an example, I have no too strong English, therefore the end of the 2. case is can not be understandable to me for these words: (prelude, coda)

Sorry for the inconvenience.

csaba

Bear Bibeault wrote:Using the include action causes the "sub" JSP to be evaluated on its own. Any directives within it, are confined to the sub-JSP.

1.If your intent is to include the directives in the main JSP, you want to use the include directive instead of the action.

2.If your intent is to just include something at the head (or tail) of each and every JSP, look into defining a prelude (or a coda).
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
 
Csaba Szegedi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Bear,

Thanks for your quick and useful reply. I understood the main difference in syntax and semantic.

Bear Bibeault wrote:Perhaps the JSP FAQ entry on includes can help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!