Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Adding a common to div to multiple pages?

 
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??
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • 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...
 
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
 
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
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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....
 
If you try to please everybody, your progress is limited by the noisiest fool. And this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic