• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

How to specify resources for your custom tag component

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I want to build a custom component which displays a table with specific colomns ...like text in first two colomns, icons in next three colomns.
This table diplsay will obviously use some css to style my text and some img files to display images.
Now, I want to build my tag such that:
Apart from providing data for table content, user can also specify his own css files and his own images if he wants to. If he doesnt want then he can use the default css and images.
Pls note- this is to be coded as a component.
How can I set my attributes for css and images? what should be the directory structure of this component? How can user override the default resource file by specifying his own?
Thanks,
gaurav
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Best way to do this is to either provide a ResourceBundle the user can use (which is basically a properties-file) or to allow the data to be passed in as parameters (maybe using a special tag for setting them, which stores the data in the pageContext where the other tags can then read it).
The first would be appropriate for global data that's the same all the time (like a site-wide stylesheet) only, the second for page-specific data or instance-specific data.
 
Power corrupts. Absolute power xxxxxxxxxxxxxxxx is kinda neat.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic