• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to include 'header tab' in JSP ?  RSS feed

 
Steve Yu
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I saw in some applications (like www.etrade.com), they have header tabs like "Home", "Account", "Investing", etc. If you click one tab, it pops out its own content page. This method elegantly groups information together.
I want to know ---
1. Do we have to use Javascript to do it ? Is there any way to do it without using javascript ?
2. Can we just use JSP (without javascript) to do this kind thing ? How ? any resource ?
Thanks,
Steve
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66152
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically you can do anything on the client side that you can do with HTML/JavaScript, and nothing more. JSP is a server-side technology which can help you manage the creation of the pages that are sent to the client, but once sent off to the client, you are stuck with what the browser supports.
So you need to figure out how to accomplish the client-side appearance and behaviors that you want using client-side technology, then user server-side technology (if appropriate) to render those pages.
hth,
bear
 
Andy Bowes
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Steve,
The eTrade site top-menu is server-side code not JavaScript. When you click on a menu a request for the page is sent to the server. The page itself knows which menu option should be highlighted.
This can be acheived quite easily using JSPs. Typically you will create a separate JSP that just generates the menu section page and then include this at the top or your main JSPs using <%jsp:include %>. A more elegent alternative would be to use the templating ability supported by Tiles which are part of the Apache Struts project
[ April 08, 2003: Message edited by: Andy Bowes ]
 
Steve Yu
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Andy Bowes:
Hi Steve,
The eTrade site top-menu is server-side code not JavaScript. When you click on a menu a request for the page is sent to the server. The page itself knows which menu option should be highlighted.
This can be acheived quite easily using JSPs. Typically you will create a separate JSP that just generates the menu section page and then include this at the top or your main JSPs using <%jsp:include %>. A more elegent alternative would be to use the templating ability supported by Tiles which are part of the Apache Struts project
[ April 08, 2003: Message edited by: Andy Bowes ]

Thanks lot Andy, I looked at the "source" of eTrade web site and saw the follwoing thing --
href="javascript:GoToETURL('/e/t/invest',''); //">Investing</a>
it seems that once the "Investing" tab is clicked, it uses javascript to connect to a server side code and returns back a separate page.
I certainly hope this whole thing can be done without javascript. Could you show me any sample code or web site that uses only JSP/html skill to do the top menu tab thing ? That will be greatly helpful.
Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!