Thanks for the suggestion Mark but I'm still not quite sure how you work this. Considering an end date for a product how would you code the input text box on the editProduct JSP form?
Normally: <html:text name="attname" property="endDate" /> If the value of "endDate" is null the page fails with an error message from beanutils. If we add logic: <logic:present name="attname" property="endDate"> <html:text name="attname" property="endDate" /> </logic:present> We don't then see the input box if the value is null, so we can't enter a new value. Where to from here? Kind regards mc On 6 Sep 2005 at 8:30, Mark Benussi wrote: > I would do number 3 > > Look at > > <logic/nested isPresent /> > > A few comments on the others. > > IF a database value is NULL keep it that way. A NULL is a permissible value, > and you should not attempt to correct it, with empty strings etc. > > Consider an end date for a product. You may never have one, and a NULL is a > good value here. > > 2. > > I'm a bit of a purist but I only like getters and setters for the values of > the form. I don't like to see getValueOnAMonday() etc. > > -----Original Message----- > From: Murray Collingwood [mailto:[EMAIL PROTECTED] > Sent: 06 September 2005 00:00 > To: user@struts.apache.org > Subject: Dealing with nulls > > Hi all > > Just like to say I really appreciate the help you guys provide us newbies. > I'm looking > forward to the day I will be able to help others... > > What convention do people normally use for dealing with NULL values from an > SQL > database? > > I can retrieve them okay. > I can store them in my form class okay. > But when Struts tries to display them on a form I get an exception. > > 1. Do you test them at the SQL retrieve and set a displayable value? eg > change a null > string to an empty string, change a null date to 00/00/0000 > > 2. Do you handle them in the form class with different getters and setters? > eg a different > property name for displaying them on the form > > 3. Do you handle them on the form somehow? (not sure how you would do this) > > 4. Or do you simply set your database so that the fields can't be null and > give them > defaults, ie strings always default as empty strings? > > Currently I'm tyring to use method 2, coding different property names in the > jsp and > using the getter and setter methods to transfer the null value to something > that can be > edited. I'm still working through some errors trying to process my date > fields but > wondered whether I was actually heading down the right alley? > > Kind regards > mc > > > FOCUS Computing > Mob: 0415 24 26 24 > [EMAIL PROTECTED] > http://www.focus-computing.com.au > > > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.344 / Virus Database: 267.10.18/90 - Release Date: 5/09/2005 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -- > No virus found in this incoming message. > Checked by AVG Anti-Virus. > Version: 7.0.344 / Virus Database: 267.10.18/90 - Release Date: 5/09/2005 > FOCUS Computing Mob: 0415 24 26 24 [EMAIL PROTECTED] http://www.focus-computing.com.au -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.10.18/90 - Release Date: 5/09/2005 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]