title: Dynamically add attribute to struts2 UI tag
body: <p>Is there a way to dynamically add an attribute to a struts 2, tag UI tag such as a textfield?</p>
  
  <p>The reason is that I want to add a <code>readOnly</code> form field attribute to an <code>&lt;s:textfield/&gt;</code>, depending on an action's method result. I cannot use <code>readOnly="%{isReadOnly()}"</code> since once the attribute is defined, the form element is read-only, no matter what value it has. And wrapping each form field into an <code>&lt;s:if/&gt;</code> tag is pretty cumbersome and results in a lot of code duplication.</p>
  
  <p>I would also like to avoid JavaScript for interoperability reasons and for not relying on the browser's scripting settings.</p>