[Opensource] No ActionForm found for key '" + formKey + "' in session error

Michael Rimov rimovm at centercomp.com
Mon Aug 5 19:33:42 PDT 2002


At 05:19 PM 8/5/2002 +1000, you wrote:
>This exception occurs when calling the following method in the 
>ControllerResponse object
>Method -
>     private DefaultForm getDefaultForm() throws ControllerException {
>          String formKey = getRequest().getFormAttribute();
>         if (StringUtil.notNull(formKey).equals("")) {
>             throw new ControllerException("No ActionForm has been 
> specified for this Controller mapping,"
>                 + " unable to utilize form cache. Please set an action 
> form in the struts-config.xml file.");
>         }
>         DefaultForm myForm = (DefaultForm) 
> getRequest().getSession().getAttribute(formKey);
>         if (myForm == null) {
>             throw new ControllerException("No ActionForm found for key '" 
> + formKey + "' in session.");
>         }
>         return myForm;
>     }

Well, usually you have a null form of for some reason the Controller isn't 
calling setFormAttribute() before your code is executed.  The most likely 
cause is a misconfiguration in your struts-config.xml (or equiv) that isn't 
setting the action form name to at least "default".

HTH!
                                                 -Mike




More information about the Opensource mailing list