Results 1 to 5 of 5

Thread: <spring:bind > again

  1. #1
    Join Date
    May 2006
    Posts
    2

    Default <spring:bind > again

    Neither Errors instance nor plain target object for bean name 'releaseSearchList' available as request attribute error again
    I tried some of the posted questions in the forums. Everyone was saying that I should use a SimpleFormController with bind but I had much problems trying to get that to work.
    Thank you all who attemp to help me resolve my problem. My code is due in a week LMAO.

    config:
    Code:
       <bean id="releaseSearchController" class="com.att.ivr.drm.ui.release.ReleaseSearchController">
        <property name="commandName" value="releaseSearchList" />
        <property name="commandClass" value="com.xxx.xxx.drm.to.ReleaseTO" />
        <property name="commandView"><value>release/release-search</value></property>  
        <property name="userFindService" ref="userFindService" />
        <property name="releaseFindService" ref="releaseFindService" />
      </bean>

    jsp:
    Code:
     
      <dt><label for="releaseName">Release Name:</label></dt>
      <dd><spring:bind path="releaseSearchList.releaseName">
               <input name="releaseName" type="text" maxlength="10" value="<c:out value="${status.value}"/>" />
          </spring:bind>
      </dd>
    controller:
    Code:
    public class ReleaseSearchController extends AbstractCommandController { 
    
    ...
    protected ModelAndView handle(HttpServletRequest request,
    			HttpServletResponse response, Object command, BindException errors)
    			throws Exception {
    
    		...
           ModelAndView mav = new ModelAndView(commandView, ModelConstants.MODEL, model);
           
           mav.addObject("errors", errors.getModel());
           
           return mav;
    	}
    Thank you very much

  2. #2
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    I really recommend you use SimpleFormController if you are manipulating a form. Take a look at the samples that came with Spring for more info.

  3. #3
    Join Date
    Dec 2005
    Posts
    16

    Default

    What about if you want to present a form of search criteria AND the results of a search on the same view? Is SimpleFormController the easiest/best choice in this situation? I'm struggling with how to ensure the entered search criteria remains from request to request. sessionForm=True works well in the default Get/Post form metaphor but gets a bit sketchy with the scenario desired here.

  4. #4
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    It all depends on how complex the search will be. If it is a single search term /search.htm?searchTerm=xyz then I would just use a Controller and manually check for the presence of the searchTerm. If it exists, do the search and put the results in the model.

    If it is more complicated I would use a SFC and have the form/success page as the same, but if you are doing binding, the MAV returned from onSubmit *must* contain the errors model (mav.putAll(errors.getModel()).

    This comes up so many times I might do a FAQ type entry tomorrow....

  5. #5
    Join Date
    Dec 2005
    Posts
    16

    Default Success

    Yes, a painfully obvious FAQ entry would be appreciated. Your hint was just the ticket:

    In a standard onSubmit() i've included what was suggested:

    Code:
    mav.addAllObjects(errors.getModel());
    mav.addAllObjects(referenceData(request, command, errors));
    Don't know if the referenceData technique is the best but it is required as the form and success views are, in this situation, the same.

    Thanks for the tip!.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •