spring-framework / org.springframework.web.bind / ServletRequestUtils / getDoubleParameter

getDoubleParameter

@Nullable open static fun getDoubleParameter(request: ServletRequest, name: String): Double

Get a Double parameter, or null if not present. Throws an exception if it the parameter value isn't a number.

Parameters

request - current HTTP request

name - the name of the parameter

Exceptions

ServletRequestBindingException - a subclass of ServletException, so it doesn't need to be caught

Return
the Double value, or null if not present

open static fun getDoubleParameter(request: ServletRequest, name: String, defaultVal: Double): Double

Get a double parameter, with a fallback value. Never throws an exception. Can pass a distinguished value as default to enable checks of whether it was supplied.

Parameters

request - current HTTP request

name - the name of the parameter

defaultVal - the default value to use as fallback