aspose file tools*
The moose likes JSP and the fly likes How can i reuse My menu panel  in jsp ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How can i reuse My menu panel  in jsp ?" Watch "How can i reuse My menu panel  in jsp ?" New topic
Author

How can i reuse My menu panel in jsp ?

sreejith sree
Greenhorn

Joined: Feb 18, 2008
Posts: 2
I have 4 jsp pages , in every pages i have the same menu (navigation menu)
with home , about me , contacts, photo gallery,

i want to know if there any option , jsp gives me to store this menu in one place and reuse this menu control in every page ,

some thing like this.

<jsp use menu ="menu1" >


i dont know much abt jsp , but .net , i have custom user control ,

i cant put menu in user control and call on any aspx page,

kindly tell me , if there is any option in jsp ...


sreejithsssss
Shikhar Madhok
Ranch Hand

Joined: Dec 18, 2006
Posts: 95
.Net is greek and latin to me.
The best way of reusing the menu would be to separate the piece of code geenrating the menu into a separate jsp and include that jsp in each of your other 4 jsps ussing the <include> tag.

This was your code is being reused and is clean.

HTH
Shikhar


He who asks a question is a fool for five minutes; he who does not ask a question remains a fool forever - Chinese proverb
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

We have an article in our JSP FAQ that covers the two types of includes provided by JSP.
http://faq.javaranch.com/java/IncludesActionDirective

You might also want to look into JSP tag files, which are custom tags that can be written in JSP syntax.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can i reuse My menu panel in jsp ?