Friday, March 30, 2007

 

Struts and messageResources.properties

Collecting all of your strings in one file is a good idea (as long as they're sorted somehow -- otherwise it just becomes an incomprehensible jumble). Struts has a very smart way to do this. (That's right, I can admit when something is smart) messageResources.properties and <bean:message /> You can pass in arguments that round out the message and make it more dynamic-y. This is a good thing.

I couldn't figure out how to get Javascript variables in there until Kevin, a sneaky-smart programmer who, like me has a background in C++, and who learned JSPs way faster than I did, pointed out a way to swap them in there after calling the bean:message.

In the messageResources.properties entry, stick an @2bReplaced in there where 2bReplaced is a meaningful variable name. So like this:

errors.badDate=The date @Date is bad.

Then in Javascript, you would do this:

var date = "02/25/-2007";//or something equally inane
var badDateMessage = "<bean:message key='errors.badDate' />"
badDateMessage = badDateMessage.replace(/@Date/g, date);

And then use the error message how you normally would.

So thanks, Kevin, for chucking that piece of functionality my way and making me and the UE people feel better about ourselves.





powered by performancing firefox

Labels:


Wednesday, March 21, 2007

 

Happy Anno-versary

This time, last year, I stepped into my cubicle and into a life of software development.



It's been a fast year. The amount of stuff going on, the amount of work yet to do and the lack of sleep have all combined to speed this year along.



It's hard to believe it's been a year but when I think about the way things were when I left Halliburton, maybe it's not so hard after all.



Here's to many more anno-versaries.





powered by performancing firefox

Labels:


This page is powered by Blogger. Isn't yours?