You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Koni <ko...@bluewin.ch> on 2003/07/31 10:38:03 UTC

Validator: Is validwhen available ?

Hi
In the Struts Validator User Guide (http://jakarta.apache.org/struts/userGuide/dev_validator.html)
I read under "Designing Complex Validations with validwhen" the following
sentence:

...
The new validwhen validation rule, which will be included into the Struts
release immediately after the 1.1 release, is designed to handle these cases.
...

Is the validator with 'validwhen' sowhere available or do we have to wait
for the next Struts release?
Thanks
Koni


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Cannot find bean error in any scope

Posted by "Altug B. Altintas" <al...@riskturk.com>.
Strange ! Now i have got no custom validation


************************************************************************
***
public ActionErrors validate(ActionMapping mapping,
javax.servlet.http.HttpServletRequest request) {

		ActionErrors errors  = null ;
		errors = super.validate(mapping,request);
		return errors;
}
************************************************************************
***

only call parent's validation method, but again it gives me

"javax.servlet.jsp.JspException: Cannot find bean error in any scope " 

Error occurs because of the code below, but why ? 

************************************************************************
***
<logic:messagesPresent> 
<UL>
 <html:messages id="error"> 
 <LI><bean:write name="error"/></LI>
 </html:messages> 
</UL> 
</logic:messagesPresent>
************************************************************************
***

if change above code like this

************************************************************************
***
<html:errors/>
************************************************************************
***

Everything works fine.. 







-----Original Message-----
From: Altug B. Altintas [mailto:altuga@riskturk.com] 
Sent: Thursday, July 31, 2003 12:16 PM
To: 'Struts Users Mailing List'
Subject: Cannot find bean error in any scope 


Hi, 
 
My form extends ValidationForm, and of course i have got validator-rules
and validation.xml. 
But when i want to make a custom valition in validate() method ,  i took
"javax.servlet.jsp.JspException: Cannot find bean error in any scope " 
 

My jsp page includes the code below to show the errors: 
 
*************************************
<logic:messagesPresent> 
<UL>
 <html:messages id="error"> 
 <LI><bean:write name="error"/></LI>
 </html:messages> 
</UL> 
</logic:messagesPresent>
*************************************

	
overriding validate() method
 
************************************************************************
*
 public ActionErrors validate(ActionMapping mapping,
         javax.servlet.http.HttpServletRequest request) {
 
  ActionErrors errors  = null ;
  errors = super.validate(mapping,request);
  try {
 
   
   if (errors == null) {
    errors = new ActionErrors();
   }   
   
 
   Calendar c1 = dUtils.str2Calendar(startdate);
 
   Calendar c2 = dUtils.str2Calendar(enddate);
 
   // if enddate bigger then startdate then add error
   if ( !c1.before(c2) ) { // custom validation
    errors.add(ActionErrors.GLOBAL_ERROR ,new
ActionError("errors.dateerror","test");    
   }
  
    // print out the errors
   Iterator it = errors.get();
   while ( it.hasNext() ) {
    ActionError ae = (ActionError) it.next();
    System.out.println("Errors  : " + ae.getKey() + " " );
    int length = ae.getValues().length;
    Object[] o = ae.getValues();
    for (int i=0; i<length ; i++) {
     System.out.println("  : " + o[i] + " " ); 
    }
    System.out.println("************************************" );
   }
 
  } catch ( Exception ex ) {
   System.out.println("Ex: " + ex);
  } finally {
   if (errors.isEmpty()) {
    return null;
   }
   
   return (errors);
  }
 }
************************************************************************
*

Any idea ? 
 
Regards


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Cannot find bean error in any scope

Posted by "Altug B. Altintas" <al...@riskturk.com>.
Hi, 
 
My form extends ValidationForm, and of course i have got validator-rules
and validation.xml. 
But when i want to make a custom valition in validate() method ,  i took
"javax.servlet.jsp.JspException: Cannot find bean error in any scope " 
 

My jsp page includes the code below to show the errors: 
 
*************************************
<logic:messagesPresent> 
<UL>
 <html:messages id="error"> 
 <LI><bean:write name="error"/></LI>
 </html:messages> 
</UL> 
</logic:messagesPresent>
*************************************

	
overriding validate() method
 
************************************************************************
*
 public ActionErrors validate(ActionMapping mapping,
         javax.servlet.http.HttpServletRequest request) {
 
  ActionErrors errors  = null ;
  errors = super.validate(mapping,request);
  try {
 
   
   if (errors == null) {
    errors = new ActionErrors();
   }   
   
 
   Calendar c1 = dUtils.str2Calendar(startdate);
 
   Calendar c2 = dUtils.str2Calendar(enddate);
 
   // if enddate bigger then startdate then add error
   if ( !c1.before(c2) ) { // custom validation
    errors.add(ActionErrors.GLOBAL_ERROR ,new
ActionError("errors.dateerror","test");    
   }
  
    // print out the errors
   Iterator it = errors.get();
   while ( it.hasNext() ) {
    ActionError ae = (ActionError) it.next();
    System.out.println("Errors  : " + ae.getKey() + " " );
    int length = ae.getValues().length;
    Object[] o = ae.getValues();
    for (int i=0; i<length ; i++) {
     System.out.println("  : " + o[i] + " " ); 
    }
    System.out.println("************************************" );
   }
 
  } catch ( Exception ex ) {
   System.out.println("Ex: " + ex);
  } finally {
   if (errors.isEmpty()) {
    return null;
   }
   
   return (errors);
  }
 }
************************************************************************
*

Any idea ? 
 
Regards

RE: Validator: Is validwhen available ?

Posted by Steve Raeburn <sr...@apache.org>.
The nightly builds are not working for now because of a problem with the
build machine.

ValidWhen has been added to the source but, for now, you'll need to check it
out from CVS and do your own build.
It will be included in the 1.2 release which will come along a lot sooner
than the 1.1 release did :-)

Steve

  -----Original Message-----
  From: Nagendra Kumar O V S [mailto:nagendra@ikigo.com]
  Sent: July 31, 2003 1:49 AM
  To: struts-user@jakarta.apache.org
  Subject: Re: Validator: Is validwhen available ?


        hi,
        'validwhen' is available in the nightly builds...

        -- nagi

        -------Original Message-------

        From: Struts Users Mailing List
        Date: Thursday, July 31, 2003 02:08:30 PM
        To: struts-user@jakarta.apache.org
        Subject: Validator: Is validwhen available ?

        Hi
        In the Struts Validator User Guide
(http://jakarta.apache.org/struts/userGuide/dev_validator.html)
        I read under "Designing Complex Validations with validwhen" the
following
        sentence:

        ....
        The new validwhen validation rule, which will be included into the
Struts
        release immediately after the 1.1 release, is designed to handle
these cases.
        ....

        Is the validator with 'validwhen' sowhere available or do we have to
wait
        for the next Struts release?
        Thanks
        Koni


        --------------------------------------------------------------------
-
        To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
        For additional commands, e-mail: struts-user-help@jakarta.apache.org


        .


  ____________________________________________________
    IncrediMail - Email has finally evolved - Click Here

Re: Validator: Is validwhen available ?

Posted by Nagendra Kumar O V S <na...@ikigo.com>.
hi,
'validwhen' is available in the nightly builds...

-- nagi

-------Original Message-------

From: Struts Users Mailing List
Date: Thursday, July 31, 2003 02:08:30 PM
To: struts-user@jakarta.apache.org
Subject: Validator: Is validwhen available ?

Hi
In the Struts Validator User Guide (http://jakarta.apache
org/struts/userGuide/dev_validator.html)
I read under "Designing Complex Validations with validwhen" the following
sentence:

....
The new validwhen validation rule, which will be included into the Struts
release immediately after the 1.1 release, is designed to handle these cases

....

Is the validator with 'validwhen' sowhere available or do we have to wait
for the next Struts release?
Thanks
Koni


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


.