10

Variation 1:

 file.jsp?parameter1=&parameter2=abc

Variation 2:

 file.jsp?parameter1&parameter2=abc

I know Variation 1 is considered valid, but is variation 2 considered valid? Specifically, there is no value for the parameter, is the equals sign required in this case?

1

1 Answer 1

4

I think it is valid to have query parameter with just the parameter name.

If you are familiar with Java, Look at the @see UriComponentsBuilder QueryParam function, by default it does this for any query parameter with null.

If no values are given, the resulting URI will contain the query parameter name only (i.e. ?foo instead of ?foo=bar.

See this answer for more info. Is a url query parameter valid if it has no value?

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.