On 3/9/08, Waldo Rochow <[EMAIL PROTECTED]> wrote: > I have added this work-around (read "hack") to get the unit tests to > work, and to get the page flow behaving properly. > > === CODE from PersonFormController.java === > public ModelAndView handleRequest(HttpServletRequest request, > HttpServletResponse response) throws Exception { > if(request.getMethod().equalsIgnoreCase("post")){ > return onSubmit(request, response, > formBackingObject(request), new BindException()); > } else { > return super.handleRequest(request, response); > } > } > > > But in doing so, I see that nothing is getting saved to the database. > There is no log message from the GenericManager, so I added the > following to my PersonFormController.onSubmit(). > > === CODE from PersonFormController.java === > if (request.getParameter("delete") != null) { > personManager.remove(person.getId()); > saveMessage(request, getText("person.deleted", locale)); > } else { > * log.debug("The original person is: " + person.toString());* > * Person updatedPerson = personManager.save(person); > log.debug("The updated person is: " + updatedPerson.toString()); > * String key = (isNew) ? "person.added" : "person.updated"; > saveMessage(request, getText(key, locale)); > > if (!isNew) { > success = "redirect:personform.html?id=" + person.getId(); > } > } > > > It produced the following log even though I changed Matts first name to > Mathiew (sorry ;-). > === LOG of transition from: person form -> persons list === > [cbeyond] DEBUG [btpool0-1] PersonFormController.onSubmit(59) | entering > 'onSubmit' method... > [cbeyond] DEBUG [btpool0-1] PersonFormController.onSubmit(71) | The > original person is: > [EMAIL PROTECTED],firstName=Matt,lastName=Raible] > [cbeyond] DEBUG [btpool0-1] PersonFormController.onSubmit(73) | The > updated person is: > [EMAIL PROTECTED],firstName=Matt,lastName=Raible] > > > I don't know if this is related, but I suspect it is. > > Thanks again, > Waldo > > Waldo Rochow wrote: > > I'm hoping that someone can help me. I have been running through the > > spring tutorial with hibernate, and all was going well until the > > PersonFormController. > > > > The behavior that I'm seeing is that when editing a person, I click on > > the save button and get redirected to the persons list. The changes > > that have been made are not persisted, and the log doesn't display the > > "entering 'onSubmit' method..." log message. > > > > What bothers me is the following line from the logs since my class > > doesn't implement that method, I am assuming that one of the parents > > is trying to handle the request. > > > > PersonFormController.processFormSubmission(266) | No errors -> > > processing submit > > > > I have Googled for hours, and not found anything like this, so I am at > > my wits end. > > > > Some relevant code and log snippets follow. > > > > Thanks in advance, > > Waldo > > > > > > === CODE from personform.jsp === > > ... > > <form:form commandName="person" method="POST" action="personform.html" > > id="personForm"> > > <form:errors path="*" cssClass="error" element="div"/> > > <form:hidden path="id"/> > > <ul> > > <li> > > <appfuse:label styleClass="desc" key="person.firstName"/> > > <form:errors path="firstName" cssClass="fieldError"/> > > <form:input path="firstName" id="firstName" cssClass="text > > medium"/> > > </li> > > > > <li> > > <appfuse:label styleClass="desc" key="person.lastName"/> > > <form:errors path="lastName" cssClass="fieldError"/> > > <form:input path="lastName" id="lastName" cssClass="text medium"/> > > </li> > > > > <li class="buttonBar bottom"> > > <input type="submit" class="button" name="save" > > value="<fmt:message key="button.save"/>"/> > > <c:if test="${not empty person.id}"> > > <input type="submit" class="button" name="delete" > > onclick="return confirmDelete('person')" > > value="<fmt:message key="button.delete"/>" /> > > </c:if> > > <input type="submit" class="button" name="cancel" > > value="<fmt:message key="button.cancel"/>"/> > > </li> > > </ul> > > </form:form> > > ... > > > > === CODE from PersonFormController.java === > > public class PersonFormController extends BaseFormController { > > > > ... > > > > public ModelAndView onSubmit(HttpServletRequest request, > > HttpServletResponse response, Object > > command, > > BindException errors) > > throws Exception { > > log.debug("entering 'onSubmit' method..."); > > ... > > } > > > > ... > > } > > > > === LOG of transition from: persons list -> person form -> persons > > list === > > [cbeyond] DEBUG [btpool0-1] PersonFormController.showNewForm(337) | > > Displaying new form > > [cbeyond] DEBUG [btpool0-2] > > PersonFormController.processFormSubmission(266) | No errors -> > > processing submit > > [cbeyond] DEBUG [btpool0-1] PersonController.handleRequest(31) | > > entering 'handleRequest' method... > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]