Hi
I'm using dwr to submit a form, everything's fine except that I dont get the success view or the cancel view back to my div.
I'm getting the following warning
My controller bean config is as followingCode:Apr 17, 2008 18:37:51 PM INFO org.directwebremoting.impl.DefaultRemoter - Exec: dwrUtils.forwardToString() Apr 17, 2008 18:37:51 PM WARN org.directwebremoting.util.SwallowingHttpServletResponse - Ignoring call to sendRedirect(index)
Following is my dwr configurationCode:<bean name="addContactController" class="com.edifice.controller.AddContactController"> <property name="sessionForm" value="false"/> <property name="commandName" value="contactCommand"/> <property name="commandClass" value="com.edifice.dao.Contact"/> <property name="formView" value="contactForm"/> <property name="successView" value="redirect:index"/> <property name="cancelView" value="redirect:index" /> <property name="cancelParamKey" value="cancel"/> <property name="validator" ref="contactValidator"/> <property name="salutations" ref="salutations"/> <property name="contactDaoImpl" ref="contactDaoImpl"/> <property name="clientDaoImpl" ref="clientDaoImpl"/> </bean>
Im parsing the url (with parameters+values) to dwrUtils.forwardToString methodCode:<dwr:configuration /> <dwr:controller id="dwrController" debug="false" /> <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="alwaysUseFullPath" value="true"/> <property name="mappings"> <props> <prop key="/admin/index">indexController</prop> <prop key="/admin/addclient">addClientController</prop> <prop key="/admin/adddomain">addDomainController</prop> <prop key="/admin/addplan">addPlanController</prop> <prop key="/admin/addcontact">addContactController</prop> <prop key="/admin/showcontacts">showContactsController</prop> <prop key="/admin/showclients">showClientsController</prop> <prop key="/admin/managecontacts">manageContactsController</prop> </props> </property> </bean> <bean id="dwrUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="/engine.js">dwrController</prop> <prop key="/util.js">dwrController</prop> <prop key="/interface/**">dwrController</prop> <prop key="/call/**">dwrController</prop> <prop key="/**">dwrController</prop> </props> </property> </bean> <bean id="dwrUtils" class="com.edifice.dwr.DwrUtils" scope="session"> <dwr:remote javascript="dwrUtils"> <dwr:convert type="bean" class="com.edifice.dwr.DwrUtils"> <dwr:include method="forwardToString"/> </dwr:convert> </dwr:remote> </bean>
by javascript
DwrUtils.javaCode:function submitAddContactForm(){ var url = "/admin/addcontact"; url += getParameterNamesAndValues(); dwrUtils.forwardToString(url,function(dataFromServer) { dwr.util.setValue("formDiv", dataFromServer , { escapeHtml:false }); }); return false; } function getParameterNamesAndValues(){ var namesAndValues = "?"; var form = document.getElementById("contactForm"); for (var i = 0; i < form.length; i++){ namesAndValues += form[i].name; namesAndValues += "="; namesAndValues += form[i].value; namesAndValues += "&"; } return namesAndValues; }
I was trying to find a solution for this the whole day, couldn't find any thing.Code:public class DwrUtils { private Log logger = LogFactory.getLog(getClass()); private WebContext wctx; private String result; public String forwardToString(String url) { result = ""; wctx = WebContextFactory.get(); try { result = wctx.forwardToString(url); } catch (Exception e) { logger.info("Exception : " + e); } return result; } }
the org.directwebremoting.util.SwallowingHttpServletRe sponse - Ignoring call to sendRedirect(index) only happens when im redirecting the request to another controller.
what might i be doing wrong here? Please some one help me fix this.
Thanks in advance...


Reply With Quote