Announcement Announcement Module
Collapse
No announcement yet.
<spring:bind > again Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • <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
    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.

    Comment


    • #3
      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.

      Comment


      • #4
        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....

        Comment


        • #5
          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!.

          Comment

          Working...
          X