Results 1 to 10 of 10

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

  1. #1
    Join Date
    Sep 2005
    Location
    Delhi
    Posts
    7

    Default 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.
    Thank you.

    Regards,
    Harsh

  2. #2
    Join Date
    Aug 2004
    Location
    Atlanta, GA
    Posts
    129

    Default

    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.
    Randy

  3. #3
    Join Date
    Sep 2005
    Posts
    9

    Default

    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 at 07:57 PM.

  4. #4
    Join Date
    Apr 2007
    Posts
    6

    Default

    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.

  5. #5
    Join Date
    Sep 2006
    Location
    Omaha, NE
    Posts
    60

    Default Multiple Submit Points..

    The MultiActionController won't handle form submissions.

    Check out this thread...

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

  6. #6
    Join Date
    Apr 2007
    Posts
    6

    Default 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

  7. #7

    Default

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

  8. #8
    Join Date
    Apr 2007
    Posts
    6

    Default 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?

  9. #9
    Join Date
    Apr 2007
    Posts
    6

    Exclamation

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

  10. #10
    Join Date
    Apr 2007
    Posts
    6

    Default

    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 at 08:05 AM.

Similar Threads

  1. Pageable data list with Hibernate
    By robmorgan in forum Data
    Replies: 23
    Last Post: Jul 24th, 2006, 06:12 PM
  2. Replies: 3
    Last Post: Aug 26th, 2005, 01:36 AM
  3. Replies: 0
    Last Post: Jun 10th, 2005, 08:22 AM
  4. Replies: 1
    Last Post: May 23rd, 2005, 02:56 PM
  5. Replies: 5
    Last Post: Dec 16th, 2004, 11:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •