Numeric check in struts2

I want to check a text box that should only allow the number 0-9 in any range, how can I implement this

+4
source share
2 answers

Struts2 comes with pretty good documentation. Learn how to use it :)

+4
source

I'm not sure what you mean by "in any range." To perform a numerical check, you can use the int validator:

<validator type="int"> <param name="fieldName">myfield</param> <param name="min">0</param> <param name="max">9</param> <message>MyField needs to be between ${min} and ${max}</message> </validator> 

I assume that you just need integers, not real numbers.

This page describes all available validators.

+1
source

Source: https://habr.com/ru/post/1299244/


All Articles