Announcement Announcement Module
Collapse
No announcement yet.
Multiple submit sources delegated to only one method Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple submit sources delegated to only one method

    Hi! I'm working with JSP / JSTL, and I have a form that has multiple submit sources, i. e. 4 submit buttons and one dropdown that submits the form.
    The form is submitted to a method of a Spring MultiActionController, and what I want to do is discover what is the source of the request, WITHOUT using request.getParameter("name")... I think I was told not to do that... Is there a more ellegant way to do this?? Thanks in advance!!!

  • #2
    Why not...

    Why not have each button submit to different methods then call the common method they all need to eventually access?

    Code:
    void submit() {
    // do some code here that's common to all submit methods.
    }
    
    void submitA() {
    // log something
    submit();
    }
    
    void submitB() {
    // log something
    submit();
    }
    
    etc...

    Comment

    Working...
    X