I am not sure how the linked article fits in with your issue. Did you give styleId a try? The Struts html tags have a property named styleId that renders the html id attribute which is what you would need to use with document.getElementById.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com