Hi,

I have defined a boolean property in a DynaActionForm ("volledig" which
means complete).

The value should be checked in the validate()-method.
It is easy to retrieve String-properties from the hash-map but the compiler
does not accept the following construct:
        if ((boolean)this.get("volledig"))
complaining that it :Cannot cast from Object to boolean.

How can I use this boolean value?

Ben

public class ZoekDynaActionForm extends DynaActionForm {
        public ZoekDynaActionForm() {
                super();
        }

        private Zoek data;          
        public void setData       (Zoek data)   {this.data=data;}
        public Zoek getData() {return this.data;}

        protected boolean NullOfLeeg (String str){
          return ((str == null) || (str.length() == 0));
        }       
        public void reset(ActionMapping mapping, HttpServletRequest request)
{
          this.data = new Zoek();
        }       
        public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request)     {
          ActionErrors errors = new ActionErrors();
          if ("1".equals((String)this.get("selectie"))) {
                if
("".equals((String)this.get("gemeente"))&&"".equals((String)this.get("sectie
"))&&"".equals((String)this.get("perceel"))) {
                  errors.add("Perceelkeuze", new
ActionError("error.Perceelkeuze"));
                } else {
                        if (NullOfLeeg((String)this.get("gemeente")))
errors.add("Gemeente", new ActionError("error.gemeente.verplicht")) ;
                        if (NullOfLeeg((String)this.get("sectie")))
errors.add("Sectie", new ActionError("error.sectie.verplicht"));
                        if (NullOfLeeg((String)this.get("perceel")))
errors.add("Perceel", new ActionError("error.perceel.verplicht"));
                }
          }
          
          if ("2".equals((String)this.get("selectie"))) {
==>             if ((boolean)this.get("volledig")) {
                        errors.add("Volledige naam", new
ActionError("error.naam.volledig"));
                } else {
                        errors.add("Beginletters", new
ActionError("error.naam.deel"));
                }
          }
          return (errors);
        }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to