Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
Spring XT: doAjaxSubmit in a wizard form Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring XT: doAjaxSubmit in a wizard form

    Is it possible to have doAjaxSubmit call in a wizard form?

    I have a table in a wizard form. I have a add button for adding rows in the table. When I make a doAjaxSubmit for the add button, the wizard controller is throwing

    Code:
    Invalid submit detected: Form object not found in session (in session-form mode)
    and creating a new command object. So the command object I'm getting in the AjaxHandler is empty and new and its not the same reference the jsp FORM having.

    Any help would be highly appreciated.

    I really like the concepts behind the XT Ajax framework so trying hard to make use of it.

    Thanks

  • #2
    Hi Surya,

    sorry for the late reply.

    Originally posted by surya_vus View Post
    Is it possible to have doAjaxSubmit call in a wizard form?
    I have a table in a wizard form. I have a add button for adding rows in the table. When I make a doAjaxSubmit for the add button, the wizard controller is throwing
    Code:
    Invalid submit detected: Form object not found in session (in session-form mode)
    I've never tested XT Ajax with wizard forms, but it should not be that different.

    Is your wizard configuration correct?
    If you post your wizard configuration and code I could help you better.

    However, why are you using an ajax submit?
    Maybe it could be more appropriate to use a simple ajax action (doAjaxAction).
    Please give me more details.

    Cheers!

    Sergio B.

    Comment


    • #3
      Thanks Sergio for the response.

      Originally posted by sbtourist View Post
      Is your wizard configuration correct?
      If you post your wizard configuration and code I could help you better.

      However, why are you using an ajax submit?
      Maybe it could be more appropriate to use a simple ajax action (doAjaxAction).
      I think you are right. I do not need a submit, I should be using Action instead.

      So now, when I try using Action, the handler does not seem to be getting the same command reference the jsp has.

      Here is the detail of my wizard configuration.

      myapp-servlet.xml

      Code:
      	<bean id="newCustomerWizardController" class="com.***.***.ui.controller.NewCustomerWizardController">
      		<property name="commandName" value="newCustomer" />
      		<property name="validator" ref="customerValidator" />
      	</bean>
      here are the ajaxinterceptor config

      Code:
      <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
              <property name="interceptors">
                  <list>
                      <ref bean="ajaxInterceptor"/>
                  </list>
              </property>
      		<property name="mappings">
      			<props>
      				<prop key="/newcustintro.htm">customerWizardController</prop>
      			</props>
      		</property>
      	</bean>
      
          <bean id="customerAjaxHandler" class="com.***.***.ui.handler.CustomerAjaxHandler">
          </bean>
          
          <bean id="ajaxInterceptor" class="org.springmodules.xt.ajax.AjaxInterceptor">
              <property name="handlerMappings">
                  <props>
                      <prop key="/*.htm">customerAjaxHandler</prop>
                  </props>
              </property>
          </bean>
      Here is my wizard controller

      Code:
          
      public NewCustomerWizardController()
      
          {
      
              this.setAllowDirtyBack(true);
      
              this.setPages(new String[] { "newcustintro", "newcust***", "newcust***" });
              
          }
      
          protected Object formBackingObject(HttpServletRequest request) throws Exception
      
          {
              CustomerCommand command = new CustomerCommand();
      
              command.setCustomer(new Customer());
      
              return command;
      
          }
      The command object I'm getting in the AjaxHandler seems to be null.

      Here is the jsp code

      Code:
      	
      <div class="tablewrapper1">
       <table width="100%">
          <caption>
      	<span> Officers </span>
      	<input type="button" value="Add" onclick="doAjaxAction('addOfficer', this);">
      </caption>
      	<tbody id="officers">
      	</tbody>
        </table>
      </div>
      And finally here is the AjaxHandler

      Code:
          public AjaxResponse addDBA(AjaxActionEvent event)
          {
              AbstractCustomerCommand command = (AbstractCustomerCommand)event.getCommandObject();
              Set<Officer> officers= command.getOfficers();
      
              List rows = new LinkedList();
              for(Officer officer : officers)
              {
                  TableRow row = new TableRow(officer , new String[]{"name"}, null);
                  rows.add(row);
                  
              }
              // Create an ajax action for replacing the old table body content, inserting these new rows:
              ReplaceContentAction replaceRowsAction = new ReplaceContentAction("officers", rows);
              // Create a concrete ajax response:
              AjaxResponse response = new AjaxResponseImpl();
              // Add actions:
              response.addAction(replaceRowsAction);
              
              return response;
          }

      Let me know if I missed anything.

      Thanks

      Comment


      • #4
        Originally posted by surya_vus View Post
        Thanks Sergio for the response.
        [CUT]
        Here is the detail of my wizard configuration.
        [CUT]
        Let me know if I missed anything.
        Too bad, it seems a bug in XT Ajax.
        However, it is unrelated to wizard forms.

        Can you post a Jira issue for it?

        Thanks,
        Cheers,

        Sergio B.

        Comment


        • #5
          Originally posted by sbtourist View Post
          Can you post a Jira issue for it?
          I've done by myself and started working on it, watch here : http://opensource.atlassian.com/proj...browse/MOD-250

          Cheers,

          Sergio B.

          Comment


          • #6
            Thanks a lot.

            Comment


            • #7
              Originally posted by surya_vus View Post
              Thanks a lot.
              I've just fixed it.
              Let us know if it works for you.

              Cheers,

              Sergio B.

              Comment


              • #8
                Sergio,

                Do I need to get the latest libaries? If so how do I get them?

                Thanks

                Comment


                • #9
                  Originally posted by surya_vus View Post
                  Do I need to get the latest libaries? If so how do I get them?
                  Yes, you need to:

                  * Check out the latest Spring Modules source code (https://springmodules.dev.java.net/s...springmodules/)

                  * Install Ant and Ivy (see here for more info: http://jayasoft.org/ivy/doc/tutorial)

                  * Build the XT module, by going into the projects/xt directory and typing a simple "ant". Once built, you'll find its jars in projects/xt/target/dist/jars.

                  Let us know if you need more help.

                  Cheers!

                  Sergio B.

                  Comment


                  • #10
                    Sergio,

                    When I try to login using WinCVS to checkout the code I'm getting this error

                    Code:
                    Logging in to :pserver:[email protected]:2401:/cvs
                    cvs [login aborted]: connect to cvs.dev.java.net:2401 failed: No connection could be made because the target machine actively refused it.
                    I just created an account with java.net and I'm sure I'm entering the correct password.

                    Sorry if this is the wrong forum. I haven't done this before.

                    Thanks a lot

                    Comment


                    • #11
                      Originally posted by surya_vus View Post
                      When I try to login using WinCVS to checkout the code I'm getting this error
                      Code:
                      Logging in to :pserver:[email protected]:2401:/cvs
                      cvs [login aborted]: connect to cvs.dev.java.net:2401 failed: No connection could be made because the target machine actively refused it.
                      Yesterday there was a planned outage for java.net projects area ... please try again today and let us know.

                      Cheers,

                      Sergio B.

                      Comment


                      • #12
                        No luck

                        I tried again, and this time by creating another user id (suryavus) and still getting the same error

                        Code:
                        cvs -d :pserver:[email protected]:/cvs login 
                        Logging in to :pserver:[email protected]:2401:/cvs
                        cvs [login aborted]: connect to cvs.dev.java.net:2401 failed: No connection could be made because the target machine actively refused it. 
                        
                        ***** CVS exited normally with code 1 *****

                        Comment


                        • #13
                          Sergio,

                          My collegue also seems to be having this issue. So this might be our work network configuration or something. Let me try from my home and let you know.

                          Thanks

                          Comment


                          • #14
                            Try guest@ (unless you have read/write access with your account)?

                            Comment


                            • #15
                              No worries. I'm able to download from my home.

                              Thanks

                              Comment

                              Working...
                              X