Originally posted by Bryce Martin:
If a bean class variable has no value how do I check that?
Originally posted by Bryce Martin:
But the value of the getParameter("purchase_order") should be null since I didn't enter anything into the field.
none of the tests that I know of to check if its null, or blank seem to work.
No, I don't have any logging in my program. How would I turn that on and where would the results be?
No, you are missing the point. How do you check for equality, rather than identify, in Java? Is it with the == operator?Originally posted by Bryce Martin:
Bear, I understand that statement shouldn't do anything.
Incorrect. null and the empty string are not even remotely alike.I know that an empty string would be a null value
Because the parameter is not null. It will be the empty string if you leave a field blank (but not disabled).The question has become this.... Why does the line of code
not meet the criteria of myBeanClass.getPurchaseOrder() == null when the parameter is null?
null is a Java concept, not an HTTP one. The parameter will either not exist or it will be the empty string. There will never be a parameter whose value is null.why would the form not post a null value when the field is empty?
This is because you are missing a basic Java point: How do you test for the empty string? You have yet to demonstrate that you know how to do this.Nothing adds up.
Don't get me started about those stupid light bulbs. |