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

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

    I am getting the following stacktrace:

    Code:
    java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'searchBean' available as request attribute
            at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:137)
            at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:179)
            at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.resolveCssClass(AbstractHtmlElementTag.java:502)
    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:
    Code:
    	<start-state idref="search"/>
    
    	<view-state id="search" view="searchpage">
    		<render-actions>			
    			<action bean="formAction" method="setupForm"/>
    		</render-actions>
    		<transition on="search" to="searchresults">
    			<action bean="formAction" method="bindAndValidate"/>		
    		</transition>
    		<transition on="main" to="mainmenu">
    			<action bean="formAction" method="bindAndValidate"/>		
    		</transition>
    	</view-state>
    heres the bean:

    Code:
    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)
    	{
    		this.name = name;
    	}
    	
    	public String toString()
    	{
    		String retVal = "name: " + name + "\n\n";
    		return retVal;
    	}
    }
    heres the search-flow-beans.xml:
    Code:
    	<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"/>
    		</property>
    	</bean>
    heres the jsp:
    Code:
    <form:form commandName="searchBean" method="post">  
    	<table bgcolor="f8f8ff" border="0" cellspacing="0" cellpadding="5"> 
    		<tr>
    			<td>Name: </td>
    			<td><form:input path="name"/></td>
    		</tr>
    	</table>  
    	<br>  
    	<spring:hasBindErrors name="searchBean">    
    		<b>Please enter a name</b>  
    	</spring:hasBindErrors>  
    	<br>
    	<br>  
    	<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}">
    	<input type="submit" class="button" value="Search">
    	<input type="hidden" name="_eventId" value="search">
    </form:form>
    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.

    Comment

    Working...
    X