Package org.springframework.web.bind

# Class MissingServletRequestParameterException

java.lang.Object
java.lang.Throwable
java.lang.Exception
jakarta.servlet.ServletException
org.springframework.web.bind.ServletRequestBindingException
org.springframework.web.bind.MissingRequestValueException
org.springframework.web.bind.MissingServletRequestParameterException

All Implemented Interfaces:
  `Serializable`, `ErrorResponse`

public class MissingServletRequestParameterException extends MissingRequestValueException
`ServletRequestBindingException` subclass that indicates a missing parameter.

Since:
  2.0.2
Author:
  Juergen Hoeller
See Also:
  - Serialized Form

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.springframework.web.ErrorResponse

`ErrorResponse.Builder, ErrorResponse.Interceptor`

## Constructor Summary

Constructors
Constructor
Description
`MissingServletRequestParameterException(String parameterName, String parameterType)`
Constructor for MissingServletRequestParameterException.
`MissingServletRequestParameterException(String parameterName, String parameterType, boolean missingAfterConversion)`
Deprecated, for removal: This API element is subject to removal in a future version.
in favor of `MissingServletRequestParameterException(String, MethodParameter, boolean)`
`MissingServletRequestParameterException(String parameterName, org.springframework.core.MethodParameter parameter, boolean missingAfterConversion)`
Constructor with a `MethodParameter` instead of a String parameterType.

## Method Summary

Modifier and Type
Method
Description
`String`
`getMessage()`
`org.springframework.core.MethodParameter`
`getMethodParameter()`
Return the target `MethodParameter` if the exception was raised for a controller method argument.
`final String`
`getParameterName()`
Return the name of the offending parameter.
`final String`
`getParameterType()`
Return the expected type of the offending parameter.

### Methods inherited from class org.springframework.web.bind.MissingRequestValueException

`isMissingAfterConversion`

### Methods inherited from class org.springframework.web.bind.ServletRequestBindingException

`getBody, getDetailMessageArguments, getDetailMessageCode, getStatusCode`

### Methods inherited from class jakarta.servlet.ServletException

`getRootCause`

### Methods inherited from class java.lang.Throwable

`addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.springframework.web.ErrorResponse

`getDetailMessageArguments, getHeaders, getTitleMessageCode, getTypeMessageCode, updateAndGetBody`

## Constructor Details

### MissingServletRequestParameterException

public MissingServletRequestParameterException(String parameterName, String parameterType)
Constructor for MissingServletRequestParameterException.

Parameters:
  `parameterName` - the name of the missing parameter
  `parameterType` - the expected type of the missing parameter

### MissingServletRequestParameterException

public MissingServletRequestParameterException(String parameterName, org.springframework.core.MethodParameter parameter, boolean missingAfterConversion)
Constructor with a `MethodParameter` instead of a String parameterType.

Parameters:
  `parameterName` - the name of the missing parameter
  `parameter` - the target method parameter for the missing value
  `missingAfterConversion` - whether the value became null after conversion
Since:
  6.1

### MissingServletRequestParameterException

@Deprecated(since="6.1", forRemoval=true) public MissingServletRequestParameterException(String parameterName, String parameterType, boolean missingAfterConversion)
Deprecated, for removal: This API element is subject to removal in a future version.
in favor of `MissingServletRequestParameterException(String, MethodParameter, boolean)`
Constructor for use when a value was present but converted to `null`.

Parameters:
  `parameterName` - the name of the missing parameter
  `parameterType` - the expected type of the missing parameter
  `missingAfterConversion` - whether the value became null after conversion
Since:
  5.3.6

## Method Details

### getMessage

public String getMessage()

Overrides:
  `getMessage` in class `Throwable`

### getParameterName

public final String getParameterName()
Return the name of the offending parameter.

### getParameterType

public final String getParameterType()
Return the expected type of the offending parameter.

### getMethodParameter

@Nullable public org.springframework.core.MethodParameter getMethodParameter()
Return the target `MethodParameter` if the exception was raised for a controller method argument.

Since:
  6.1