Thanks Mike.
It's working now after using property editor class.
But still  there is one problem.I am not able to populate the list of areas
and webSystemImpacted in  the jsp.
In the engagementformform.jsp i am doing like this...

<appfuse:label styleClass="desc" key="engagementform.systems"/>
    <spring:bind path="engagementform.systems"> 
                      <SELECT name="system">
                          <c:forEach var="sys" items="${webSystemImpacted}"> 
                              <OPTION value='<c:out value="${sys.id}" />'
<c:if test="${engagementform.systems.id==sys.id}">SELECTED</c:if>> 
                              <c:out value="${sys.name}"/> </OPTION> 
                          </c:forEach> 
                      </SELECT> 
    </spring:bind> 

And in onSubmit() method of EngagementformController.java i am doing like... 

  ModelAndView modelview = new ModelAndView(success);
       
modelview.addObject("webSystemImpacted",webappssystemManager.getAll());
        modelview.addObject("areas",areasimpactedManager.getAll());
        return modelview;

When i am calling engagementformform.jsp for editing record  the  the flow
goes to formBackingObject method of EngagementformController.java not the
onSubmit(),but i am not getting how will i populate 
"webSystemImpacted" in formBAckingObject method


Michael Horwitz wrote:
> 
> Quoted from the thread mentioned:
> 
> You are going to need to provide Spring MVC with a way to get from an id
> to
> a country and vice-versa.  As you correctly point out this is done by
> registering a custom property editor in your controller. To do this you
> need
> to:
> 
> 1) Extend the class PropertyEditorSupport to create the property
> editor:
> http://java.sun.com/j2se/1.5.0/docs/api/java/beans/PropertyEditorSupport.html
> 
> 
> You need to override the getAsText() and setAsText() methods. The first
> should call getValue() and return the id as text, and the second should
> accept a text id and call setValue() on the editor with the corresponding
> country object.
> 
> 2) You then register this custom editor using one of the appropriate
> methods
> on your controller: initBinder() see api on http://tinyurl.com/2sutrm
> 
> And it should all work like magic....
> 
> Mike.
> 
> 
> On 7/3/07, Msarda <[EMAIL PROTECTED]> wrote:
> 
>>
>> Thanks Mike for your reply.
>>
>> Actually i am not getting a clear idea about how to implement
>> PropertyEditorSupport Class excatly in my form controller.
>> It will be very helpful if u can explore about it a bit more.
>>
>>
>> Michael Horwitz wrote:
>> >
>> > You need to register a custom editor inside your form controller so
>> that
>> > Spring can convert your model object to/from text. Please see this
>> thread
>> > for further details:
>> >
>> >
>> http://www.nabble.com/Add-ManyToOne-relationship-between-user-and-a-new-pojo-tf3993393s2369.html
>> >
>> > Mike.
>> >
>> >
>> > On 7/2/07, Msarda <[EMAIL PROTECTED]> wrote:
>> >>
>> >>
>> >> Hi,
>> >>
>> >> I have three model objects Engagementform,Areasimpacted,Webappssystem.
>> >> I have many to many mapping in Engagementform & Areasimpacted   and
>> >> Engagementform  & Webappssystem.
>> >> I have used following  in Engagementform.java
>> >> Set<Webappssystem> systems;
>> >> Set<Areasimpacted> areasImpacted;
>> >>
>> >> I want to take the data for this two sets from the jsp of
>> Engagementform
>> >> not
>> >> from separate jsps generated by maven for these two sets.
>> >> I have customized the jsp for Engagementform  generated by
>> appfuse/maven
>> >> by
>> >> adding <select/> tag for these two sets as
>> >>
>> >> <li>
>> >>      <appfuse:label styleClass="desc" key="engagementform.systems"/>
>> >>      <spring:bind path="engagementform.systems">
>> >>      <select name="systems" multiple="true">
>> >>      <option value="BPAYBiller">BPAY Biller </option>
>> >>      <option value="DocumentGenerationSystem">Document Generation
>> >> System</option>
>> >>      <option value="RelationshipPricingModel">Relationship Pricing
>> >> Model</option>
>> >>      <option value="Business Banking">Business Banking</option>
>> >>      <option value="BisTracker">BisTracker</option>
>> >>      <option value="EventTracker">Event Tracker</option>
>> >>      <option value="Other:">Other:</option>
>> >>     </select>
>> >>    </spring:bind>
>> >>    </li>
>> >>
>> >> But when i tried to select from the list and save the
>> >> Engagementform  object
>> >> i am getting error
>> >>
>> >> Failed to convert property value of type [java.lang.String[]] to
>> required
>> >> type [java.util.Set] for property areasImpacted; nested exception is
>> >> java.lang.IllegalArgumentException: Cannot convert value of type
>> >> [java.lang.String] to required type
>> [au.com.suncorp.model.Areasimpacted
>> ]
>> >> for
>> >> property areasImpacted[0]: no matching editors or conversion strategy
>> >> found
>> >> Failed to convert property value of type [java.lang.String[]] to
>> required
>> >> type [java.util.Set] for property systems; nested exception is
>> >> java.lang.IllegalArgumentException: Cannot convert value of type
>> >> [java.lang.String] to required type
>> [au.com.suncorp.model.Webappssystem
>> ]
>> >> for
>> >> property systems[0]: no matching editors or conversion strategy found
>> >>
>> >>
>> >> I tried to change setter for these two properties manually but i am
>> >> getting
>> >> test cases failure.
>> >> can anybody please tell me what should i do....
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Problem-with-ManyToMany-Mapping-tf4009715s2369.html#a11387191
>> >> Sent from the AppFuse - User mailing list archive at Nabble.com.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Problem-with-ManyToMany-Mapping-tf4009715s2369.html#a11404132
>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-ManyToMany-Mapping-tf4009715s2369.html#a11455862
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to