I want to be able to create reusable components for a page. For example a component that displays name and address information that i would be able to place on different pages without having to code the same thing on multiple pages. Can I do this with a custom tag? A simple example or link to an example would be appreciated. Thanks
You didn't mention how the address data is making its way to the page, so I will assume you are using a modern Model 2 design.
Let's say that your servlet controller is placing an object of type Address that holds your address data onto the request as a scoped variable named "billingAddress", and another named "shippingAddress".
You could write a custom tag along the lines of:
which will spit out the approriate HTML-formatted data according to what it finds in the scoped variable identified by the "data" attribute.