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 Roth <ko...@bluewin.ch> on 2003/08/02 11:55:04 UTC

Re: Cannot find bean error in any scope

I had the same problem. When I wrote 'errors' it worked for me.
Try <html:messages id="errors"> and <bean:write name="errors"/>!
Hope it helps.
Koni

Swaroop George wrote:
> Why don't u use html:errors instead??
> Just give </html:errors>
> 
> 
> -----Original Message-----
> From: Altug B. Altintas [mailto:altuga@riskturk.com] 
> Sent: Thursday, July 31, 2003 4:07 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Cannot find bean error in any scope 
> 
> 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
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 


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