This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Custom Tag Question

 
Vic Newman
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I do this with a custom tag?


Absolutely.

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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic