• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding a common to div to multiple pages?

 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jsp:include or c:import (form the JSTL library). Moving to the JSP forum...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd use a tag file.
 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, but that makes me gag. Just partition the files correctly and avoid all unnecessary complexity and goop!
 
Tarun Bolla
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said at the beginning, I'd keep things nice and tidy by using a parameterizable tag file.
 
Tarun Bolla
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh! yeah...standards.... Even though its the same thing the parameterizable tag does... standards....
Thanks....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic