Announcement Announcement Module
Collapse
No announcement yet.
handelling two(or more) submit buttons on same JSP page Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • handelling two(or more) submit buttons on same JSP page

    Hello All,

    I just started to work with Spring framework and intend to use it with Hibernate. I am stuck at a point an need (a lot of :wink: ) help.

    I have a JSP with following inputs:
    user name and user id
    I have two submit buttons on this page: one update, and second delete.

    Both these buttons have their individual role to play, like one updates and secod deletes the record.

    I dont have a clue how will I post the form to two different controllers and seek your help. I need your help in configuring this in my springapp-servlet.xml and my JSP page.

    Like when I have only one submit button, things are simple. I have a form where I bind each of the flds, user name and user id, with respective properties of an object using <spring:bind>, then in my sprinapp-servlet.xml I declare a managed bean with the command class etc and in my controller I use the accessor methods.

    But how will I decide, which controller should be invoked depending on which of the two buttons are clicked? :?:

    I hope I was able to make my question simple and clear. I would greatly appreciate your inputs.

  • #2
    I think the most common way is to use a MultiActionController:
    http://www.springframework.org/docs/...ontroller.html

    Pick your choice of MethodNameResolver. There are quite a few discussions on multiple submit buttons in the forum, try some more searching.

    Comment


    • #3
      Hi Harsh,

      I'm using something similar to what this thread describes:

      http://forum.springframework.org/showthread.php?t=16209

      Let me know if you find a better solution, but it's working well for me.

      - KC
      Last edited by robyn; May 14th, 2006, 08:57 PM.

      Comment


      • #4
        hi plz help me out i referred to this thread

        http://forum.springframework.org/showthread.php?t=16209

        but i'm getting error

        The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.

        Comment


        • #5
          Multiple Submit Points..

          The MultiActionController won't handle form submissions.

          Check out this thread...

          http://forum.springframework.org/showthread.php?t=33201

          Comment


          • #6
            Thanks but problem

            Thanks 4 ur sincere help but the control is not going to onSubmit() even when i submit the button.
            kindly help
            thaks n regards

            Comment


            • #7
              Paste some code, that makes finding your problem easier.
              Kind regards.

              Comment


              • #8
                Thanks

                thanks i got it i made the method of form as "POST" earlier i was doing it as "GET". Now the control is going in onSubmit().
                But i was unable to find out the reason dat y its so?

                Comment


                • #9
                  if i'm using "POST" then it is giving error [/B]in case i use request.getParameter().

                  Comment


                  • #10
                    If i'm using POST then its is giving error.
                    The error is:
                    Neither Errors instance nor plain target object for bean name 'categoryEl' available as request attribute
                    Plz help me out and also tell why the error is coming?????????? and its solution

                    If i'm using get then its not giving error cos its not going to method onSubmit() , hence return ModelAndView() is not being called.

                    But i want to use "Post" cos i've multiple submit buttons and for them i can do checking in onSubmit()

                    Thanks n regards in advance
                    Do reply as early as possible
                    Last edited by prerna; Apr 24th, 2007, 09:05 AM.

                    Comment

                    Working...
                    X