Announcement Announcement Module
No announcement yet.
DWR and Spring Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • DWR and Spring

    Hi All,

    Recently i started using DWR with Spring.

    My requirement is to populate "dealer" drop down on change of "company" drop down. I am able to populate it through DWR. Here is my dwr.xml

    <create javascript="company" creator="spring">
    <param name="beanName" value="customerService"></param>
    <include method="getCRMDealers" />
    <convert match="com.ifw.admin.domain.IfwCompanies" converter="bean">
    <param name="include" value="companyId,ifwContacts"></param>
    <convert match="com.ifw.admin.domain.IfwContacts" converter="bean">
    <param name="include" value="companyName"></param>

    and here is my javascript at the jsp.
    function getDealers()
    var compId = dwr.util.getValue("company");
    company.getCRMDealers(compId, showDealer);

    function showDealer(data)
    var dealerObj = document.getElementById('dealer');
    dealerObj.options.length = 0;
    for(var i=0; i<data.length; i++)
    dealerObj.options[i] = new Option(data[i].ifwContacts.companyName, data[i].companyId);

    Now the problem is I am using SimpleFormController for my form page and using Validation to that. My question is after having dealer drop down filled from DWR, if my form page fails because of validation i applied from Spring, how to restore the dealer drop down?

    Please help in is very urgent....

  • #2
    I think you could use the SimpleFormController's referenceData method to populate lists to forms.

    DWR contains really good util library e.g. for list manipulation.