Jump to content

Recommended Posts

Posted

    public void setType(char aType) throws DishException
{
if(aType.length() == 0)
throw new DishException ("A dish type must be entered");

type = aType;
}

ERROR: object type required, but char found.[/CODE]

I am using jbuilder 3 and I am aware I am using the wrong validation but since I'm unsure what is the correct method to use for char type validation I'm here to see what help I can get.

Since I've not covered char before this is new too me.

This is the only validation error I am having others are intiger and string without any errors. I have to keep it as character and not change it.

Thanks in advance.

Posted

char is a Java primitive type, and thus not an actual object. If you where to change it to be a String or some thing that error would go away, and, in fact, String is possibly the type it's meant to be since the length method is used. Admittedly it could be nearly any object, but String length method has meaning (String is an object btw).

Posted

Thanks, I also want validation to check not at the end of entering a set of data but after each piece of data has been added how best would I be able to do this?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...