关于页面上输入框中 空格 、0 、NULL 的处理 示例

本文介绍了一种在Java中设置对象属性的方法,通过判断输入值是否为空来决定是否将其转换为整数类型并赋值给对象。涉及的属性包括位置编号、分类类型、版本号、顺序号等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ep.setPositionNum(get("positionNum").toString());
ep.setClasstype(get("classtype")!= ""?Integer.parseInt(get("classtype").toString()):null);
ep.setVersionNum(get("versionNum")!= ""?Integer.parseInt(get("versionNum").toString()):null);
ep.setOrderNum(get("orderNum")!= ""?Integer.parseInt(get("orderNum").toString()):null);
ep.setType(get("type")!=""?Integer.parseInt(get("type").toString()):null);
ep.setMeth(get("meth")!=""?Integer.parseInt(get("meth").toString()):null);

// ep.setType(get("type")!=null?Integer.parseInt(get("type").toString()):null);
// ep.setType(get("type")!=null?Integer.parseInt(get("type").toString()):0);
// ep.setMeth(get("meth")!=""?Integer.parseInt(get("meth").toString()):0);
// ep.setMeth(get("meth")!=""?Integer.parseInt(get("meth").toString()):null);

 

// entity.setPositionNum(get("positionNum")!= null?get("positionNum").toString():null);
// entity.setClasstype(get("classtype")!= null?Integer.parseInt(get("classtype").toString()):null);
// entity.setVersionNum(get("versionNum")!= null?Integer.parseInt(get("versionNum").toString()):null);
// entity.setOrderNum(get("orderNum")!= null?Integer.parseInt(get("orderNum").toString()):null);
// entity.setType(get("type")!=null?Integer.parseInt(get("type").toString()):null);
// entity.setMeth(get("meth")!=null?Integer.parseInt(get("meth").toString()):null);

 

 

转载于:https://www.cnblogs.com/meimao5211/p/3255852.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值