I will try this a second time. I earlier typed my information directly into the space online and clicked submit and never had my question show up online. I am new to java and “object oriented” programming and have lost my mentor and trying to do maintenance on a application that someone else wrote. I am working in eclipse Lomboz with jdk 1.4, struts 1.3, spring 1.3 and hibernate 2 with a mixture of hibernate and jdbc data base connections connecting to Oracle10 database and our application server is Oracles OC4J_101330. I do know that we can’t upgrade hibernate, etc because the OC4J won’t support the upgrades.
I was asked to add the following question to one of the JSP screens. “Is this an H2B job order? Yes No”. I looked at it and figured that a radio button would be the best route and went that direction. I copied some code from that page and made some field name changes, etc. so that it reads as follows:
I have the code working when “Yes” is selected but my problem is when they select “No” and it is in the defaultValue. The field in the table accepts three values, “A”, “B”, and null . My problem is when the “No” value is selected, it is not submitting a null but a space and give an error of “Invalid value” on trigger insert of the database. I have tried the following values “”, “ “, “null”, “NULL”. I have tried to put in a value of “N” and in the area where I am doing my error checking tried to re assign the value form “N” to null but haven’t been able to get that accomplished. I need some guidance on what I am doing wrong.
My preferred method is to be able to recognize a null value and to insert a null value into the table but would go with the “N” and re-assign it to a null. I think that the radio button is a better choice than a check box but would be open to change is I can be shown or explained why it would work.
The majority of the records in the database have a null in that field and only a few “A” and “B”. This is the public side of an application that had the private side written in oracle forms. If it was only for my code, I would set it up so that it accepted a “N’ in the field and change all the nulls to “N”. The private side is working ok so they don’t want to change it unless absolutely necessary.
Plus some other code (System.setProperty("H2BJOBFLAG", null);) request.setProperty("H2BJOBFLAG", null); but haven't figured out how to re-assign my parameter to have a value of null.
The above code doesn't work but used "System.out.println ("H2B:null");" inside the if statement to know that it was going into the if statement and getting print outs on my Console. I need guidance on what direction to go.
Thanks in advance.