0

What is an actual difference between ServletRequest.getParameter() and ServletRequestUtils.getStringParameter(). Is there any advantage of using a spring framework?

1 Answer 1

2

There is no difference at all between ServletRequest.getParameter() and ServletRequestUtils.getStringParameter(). The ServletRequestUtils class is useful when your parameters are of different type, you'll be able to get the parameter without the need to cast the return value and an Exception is thrown when the parameter have the wrong type. If all your parameters are String, I don't see the benefit of using ServletRequestUtils.getStringParameter() instead of ServletRequest.getParameter().

From the javadoc :

Parameter extraction methods, for an approach distinct from data binding, in which parameters of specific types are required.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.