I’m updating code in an old Java application at work but I’m pretty new to Struts 1 and I was wondering what the framework does when it see’s a null value in a form that’s trying to be accessed by the JSP?
- Does it convert null to the string null?
- Or does it leave the field in the JSP blank?
- Or does it fall over and fail?
Thanks for any insight into this,
Alexei Blue.
I assume your question is related to the null handling behavior in Struts 1 tags. Most of these tags will throw a
RuntimeExceptionif one of their supplied arguments is null, but you can often override this behavior by setting theirignoreattribute to false. Here is an example usingbean:write:In this case a blank field will be written if the
employeebean is null.You can also test for null values explicitly using
logic:notEmpty.