Announcement Announcement Module
No announcement yet.
Neither BindingResult nor plain target object for bean name 'searchBean' available... Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Neither BindingResult nor plain target object for bean name 'searchBean' available...

    I am getting the following stacktrace:

    java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'searchBean' available as request attribute
            at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(
            at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.resolveCssClass(
    The annoying part is that I copied most of the stuff from another flow that is working fine. Its probably an obvious copy/paste error or something I forgot to change but I have been looking at this for longer than I would like to admit and can't see whats wrong....I need another set of eyes...

    heres the search-flow.xml:
    	<start-state idref="search"/>
    	<view-state id="search" view="searchpage">
    			<action bean="formAction" method="setupForm"/>
    		<transition on="search" to="searchresults">
    			<action bean="formAction" method="bindAndValidate"/>		
    		<transition on="main" to="mainmenu">
    			<action bean="formAction" method="bindAndValidate"/>		
    heres the bean:

    public class SearchBean implements Serializable
    	/** Logger for this class and subclasses */    
    	protected final Log logger = LogFactory.getLog(getClass());    
    	private String name = "";
    	public String getName()
    		return name;
    	public void setName(String name)
    	{ = name;
    	public String toString()
    		String retVal = "name: " + name + "\n\n";
    		return retVal;
    heres the search-flow-beans.xml:
    	<bean id="formAction" class="org.springframework.webflow.action.FormAction">
    		<property name="formObjectClass" value="com.xactsites.producty.bus.SearchBean"/>
    		<property name="formObjectName" value="searchBean"/>
    		<property name="formObjectScope" value="FLOW"/>
    		<property name="validator">
    			<bean class="com.xactsites.producty.bus.SearchBeanValidator"/>
    heres the jsp:
    <form:form commandName="searchBean" method="post">  
    	<table bgcolor="f8f8ff" border="0" cellspacing="0" cellpadding="5"> 
    			<td>Name: </td>
    			<td><form:input path="name"/></td>
    	<spring:hasBindErrors name="searchBean">    
    		<b>Please enter a name</b>  
    	<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}">
    	<input type="submit" class="button" value="Search">
    	<input type="hidden" name="_eventId" value="search">
    This is a very simple case so I don't know why I can't figure out why the form backing object isn't found. I am puzzled.

    Thanks in advance.

  • #2
    as i figure....DUMB copy paste error

    When I came in this morning (with new eyes) I saw the issue, at the bottome of my search-flow.xml I was importing the wrong xml file should have been:
    <import resource="search-flow-beans.xml"/>. That makes perfect sense why the bean wasn't found because there was nothing specifying the bean in the flow....sorry for posting such a newbie issue.