Announcement Announcement Module
Collapse
No announcement yet.
onSubmit never called Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • onSubmit never called

    Hi there

    Im experiencing a very strange phenomenon. Im using the spring mvc, eclipse ide, and jetty.

    The jsp page gets displayed correctly. And the url to controller mapping works. It loads the data from the database using the "formBackingObject" function. But if the submit button is clicked it never reaches the "onSubmit"
    function of the controller.


    I have a controller as follows:

    @Override
    protected ModelAndView onSubmit(Object command) {
    System.out.println("kdfjas;jfasjf;ajsfja;jflasjf;l kasf;lasjfjaslkfj;asjf");
    return new ModelAndView("sites");
    }

    /* @Override
    public void doSubmitAction(Object command) throws Exception {
    System.out.println("kdfjas;jfasjf;ajsfja;jflasjf;l kasf;lasjfjaslkfj;asjf");
    }*/

    @Override
    protected Object formBackingObject(HttpServletRequest request) throws Exception {
    if (!isFormSubmission(request)) {
    Application app = new Application();
    app.setAvailableDate(new DateTime(2020,12,8,12,8,6, 2));
    app.setDescription("description");
    app.setName("johnsons");
    app.setUrl("http://webpage");
    app.setLeftPos("100px");
    app.setTopPos("300px");
    return app;
    }
    return super.formBackingObject(request);
    }


    And the jsp is:

    <%@ include file="/common/taglibs.jsp" %>


    <head><title>Application</title></head>
    <body>

    <form:form commandName="application" method="post" action="editapplication.html"
    id="applicationForm">

    <form:hidden path="id"/>
    <form:hidden path="optLock"/>
    <!-- <form:hidden path="name"/> -->
    <form:hidden path="description"/>
    <form:hidden path="url"/>
    <form:hidden path="availableDate"/>
    <form:hidden path="leftPos"/>
    <form:hidden path="topPos"/>

    <spring:bind path="application.name">
    <input type="text" name="name"
    value="<c:out value="${status.value}"/>" />
    </spring:bind>

    <input type="submit" value="theSubmitButton"/>

    </form:form>

    </body>



    If i have a hidden parameter called "name" (commented out) copies are made of it
    & displayed on the page during a submit action.


    The important servlet parts are:

    <bean id="editApplication" class="za.gov.statssa.esdmf.controller.EditApplica tionController">
    <property name="commandName" value="application"/>
    <property name="commandClass" value="za.gov.statssa.esdmf.model.Application"/>
    <property name="sessionForm" value="true"/>
    <property name="applicationService" ref="applicationService"/>
    <property name="formView" value="editapplication"/>
    <!--<property name="successView" value="index"/>-->
    </bean>

    <bean class="org.springframework.web.servlet.mvc.support .ControllerClassNameHandlerMapping"/>




    Any ideas would be very helpfull. pls

  • #2
    You'd be much better posting this on the Web forum, more likely to get a response.

    Comment


    • #3
      Ignore this one, re-posted on Web forum.................
      http://forum.springframework.org/sho...d.php?p=102492

      Comment

      Working...
      X