Two Laptop Bag*
The moose likes JSP and the fly likes Adding a common to div to multiple pages? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Adding a common to div to multiple pages?" Watch "Adding a common to div to multiple pages?" New topic
Author

Adding a common to div to multiple pages?

Rajesh Khan
Ranch Hand

Joined: Oct 16, 2011
Posts: 230
Hi i have a common div like


This div is used in multiple jsp file what wouldbe the best way to include this in multiple files. And how would i do that .
I know that you could searate CSS and javascript in separate files . How abt html. How would i go about doing this??
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

jsp:include or c:import (form the JSTL library). Moving to the JSP forum...


GenRocket - Experts at Building Test Data
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

I'd use a tag file.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rajesh Khan
Ranch Hand

Joined: Oct 16, 2011
Posts: 230
So i am using
<jsp:include page="options.jsp" />
but just out of curiosity what if i i wanted to include only a certain div from that page??
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

You can't. And it's not a "page", it's just a file. It can include anything you want, but only what you want to be included.
Tarun Bolla
Ranch Hand

Joined: Jun 20, 2011
Posts: 89
I think you can do that by passing parameter to the target page and writing when conditions based on the parameters for the display

Now in your jsp page you can check the parameter using jstl when tag and display whatever you want and hide(do not display) whatever you dont want...thus filtering content at server side
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Sorry, but that makes me gag. Just partition the files correctly and avoid all unnecessary complexity and goop!
Tarun Bolla
Ranch Hand

Joined: Jun 20, 2011
Posts: 89
Bear Bibeault wrote: Sorry, but that makes me gag
No offence... :)
Bear Bibeault wrote: Just partition the files correctly and avoid all unnecessary complexity and goop!

So instead of using "jstl when" to differentiate the grouped report things in same jsp, you say that we should create a jsp for manager report and a jsp for client report and again include the required jsp by inturn using "jstl when" in the main jsp??? ..... Isnt this the goop...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

As I said at the beginning, I'd keep things nice and tidy by using a parameterizable tag file.
Tarun Bolla
Ranch Hand

Joined: Jun 20, 2011
Posts: 89
Oh! yeah...standards.... Even though its the same thing the parameterizable tag does... standards....
Thanks....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding a common to div to multiple pages?
 
Similar Threads
Jquery form validation
Preventing inheritance in a Div
How can i write in the response through viewhandler? Or even another solution...
Speed up Application Created USing Servlets and JSP
request.getAttribute returning null