Announcement Announcement Module
Collapse
No announcement yet.
DWR and Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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

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

    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 this...it is very urgent....

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

    FYI
    DWR contains really good util library e.g. for list manipulation.
    http://directwebremoting.org/dwr/browser/lists

    Comment

    Working...
    X