I am trying to build a few components that will be used on several pages and sometimes in popup dialogs. We're using Struts 2, I am using annotations in my code and not the config file. I want to build a few components that can be easily placed within a div or span element on a page. The component may have some of it's own CSS and JS associated with it to handle layout, actions to take on buttons, etc. Because these are not being built for the masses but for a specific site, they may also need to interact with some other components on the page.. OR some other components may need to interact with this component. As an example, our site manages a list of users, and each user can have 0 or more "contacts". In several locations on the site we either inline (embed) the select of contacts, or just the list of contacts a user has (no select). As well, in a couple areas, we have pop-up dialogs that allow a user on a page to select and insert some contacts into that page. So the component is basically a contact selection component with the option of hiding the selection boxes (and select button) to just display them. The 2nd part is the ability for a page to pop up the contact selection component, and when the user selects and is all done (hits "ok" in the dialog), the underlying page should be able to get the selected contacts some how to insert or otherwise use within the page itself.
Please advise some ideas on how to best achieve this. Is it taglibs all the way, or is there some newer component way of providing css, js and more within the page it's used? How can other components get the selected list of contacts?