Html5 required fields with struts2: lost reasons?

preface: I'm currently using struts2-core-2.3.1.2, and updating is not an option.

I am trying to implement the required HTML5 fields in my struts2 form. racks don't even display this:

<s:textfield name="x_serialNbr" id="i_sn" required />

and while it will look like this:

<s:textfield name="x_serialNbr" id="i_sn" required="true" />
<s:textfield name="x_serialNbr" id="i_sn" required="required" />

the resulting HTML is not what I want:

<input type="text" name="x_serialNbr" value="" id="i_sn" />

after extensive googling, this post is the closest one over a year ago , I can find something that concerns my problem. it seems this problem has been resolved in the current version of struts2, but, as I said, I can’t update.

as far as i can see my options

  • dynamically add “required” attributes to the appropriate fields when the page loads.
  • roll my own check
  • ?? -, ? - , ?
+4
1

html, , OGNL, EL

<input type="text" name="x_serialNbr" value="<s:property value='x_serialNbr'/>" id="i_sn" required="true">
<input type="text" name="x_serialNbr" value="${x_serialNbr}" id="i_sn" required="required">
+2

All Articles