Results 1 to 4 of 4

Thread: SimpleFormController - newbie question

  1. #1

    Default SimpleFormController - newbie question

    Hi,

    (just a newbie )
    I need FORM so I implemented SimpleFormController subclass. Now I need to check, if page has been called with param "id" - e.g.:
    Code:
    viewCustomerDetail?id=1
    And if "id" is not defined I need to redirect to e.g.
    Code:
    customersList.html
    (and if possibly add error message?)

    Problem is, that onSubmit method is called only on submitting and I guess in Map referenceData(...) is not possible to determine model and overriding isFormSubmission(...) could cause some other issues.

    Could anyone help me or refer me to some reading?

    Thanks.

  2. #2
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    The easiest way to do this might be to map a HandlerInterceptor to your Controller and handle this logic in there. Alternatively, just override handleRequest() perform the check and then call super.handleRequest() when you want to proceed.

    Rob
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

  3. #3

    Default

    Could you please give me some example? I have absolutely no idea how and where to map HandlerInterceptor.

    Unfortunetly I am not sure if SimpleFormController has method handleRequest Only I have found handleRequestInternal but it is finalised in AbstractFormController

  4. #4
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    Check out section 12.4.3 of the reference manual for information on HandlerInterceptor.

    Actually, SimpleFormController does have handleRequest but it is declared final on AbstractController so a HandlerInterceptor is the best approach.

    Regards,

    Rob
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

Similar Threads

  1. Replies: 7
    Last Post: Apr 3rd, 2008, 08:38 AM
  2. Replies: 11
    Last Post: Jul 23rd, 2007, 02:09 AM
  3. Replies: 1
    Last Post: Jul 11th, 2005, 03:50 PM
  4. Replies: 3
    Last Post: Apr 3rd, 2005, 04:34 PM
  5. Replies: 1
    Last Post: Mar 23rd, 2005, 07:22 PM

Posting Permissions

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