Tera Mind
Tera Mind

Reputation: 263

Struts 2 tag lib for number textfield

I have this code in a JSP page using Struts 2 Framework to get a number.

<s:textfield type="number" name="year">

How can I specify the min, max value and step of this field like in HTML5?

<input type="number" name="year" min="2010" max="2018" step="2"/>

Upvotes: 1

Views: 6834

Answers (1)

Manoj Kumar
Manoj Kumar

Reputation: 380

It can be done by HTML 5 attributes as it is in <s:textfield>.

<s:textfield type="number" name="year" min="2010" max="2018" step="2"/>

Or try to use dynamic attribute in .tld.

<dynamic-attributes>true</dynamic-attributes>

Upvotes: 4

Related Questions