JSP形式的空字段是null还是“"? [英] Are empty fields in form of JSP null or ""?
问题描述
当表单传递到servlet时,是空字段"还是null?因此,例如在您具有名字"作为字段而姓氏"作为字段的表单中
院长-名字
- 姓
那么它在servlet中注册了什么?
提前致谢
院长
When a form is passed in to a servlet are empty fields "" or null? So for example in a form where you have First name as a field and last name as a field
Dean - First Name
- Last Name
So what is it registered as in the servlet?
Thanks in Advance
Dean
推荐答案
简单:如果存在参数名称,但没有值,则该参数为空.如果也缺少参数名称,则该参数为null.通常,您为字段指定一个名称,因此它作为请求参数出现,而空字段将作为空字符串输入.
Simple: If the parameter name is present, but value not, then it's empty. If the parameter name is absent as well, then it's null. You normally give fields a name, so it's present as request parameter and empty fields will be just come in as empty string.
这篇关于JSP形式的空字段是null还是“"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!