Are empty fields as JSP null or "?"


When the form is submitted to the servlet, are the empty fields "" or null? So, for example, in the form where you have First name as a field and last name as a field
Dean - First name
- Last name
So what is registered as in the servlet?
Thanks in advance
Dean

+3
source share
3 answers

Simple: if the parameter name is present, but the value is not, then it is empty. If the parameter name is missing, then it is null. Usually you give name fields, so it is present as a query parameter, and empty fields will be just empty.

+4
source

. JBoss , WebSphere null. PITA. , - , ( JBoss ), .

+1

I think this is up to the browser, but in most cases it will be null . You must continue to resolve both cases.

Edit:

As noted in the comments, in most cases this will be an empty string.

0
source

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


All Articles