I made a post on Sunday asking if there was an easy way (taglib) to display a random number of messages from a resource file. I took the deafening silence to mean no, so I went ahead and investigated the options.

In the end it was easiest to extend the bean:message tag.

My new version takes two new optional attributes: header and footer.

When the tag executes, if it finds a key, then first it trys to retrieve a message using the key. If a message is not found then it trys to retrieve the same message, but with an index appended to the key string like this:

message.key0

If it gets a message then it whacks the header and footer containing the formatting code for the paragraph onto the message, then increments the index and loops back to try again. This continues until there are no more message to display.

Its a simple, but (in my opinion) useful extension to the message tag allowing multiple paragraphs of text to be stored in the properties file and formatted at compile time.

If anyone is interested I can post more info.

Regards,
Langdon

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to