• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

How to specify default handler in MultiActionController.

 
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Ranchers
I am currently using MultiActionController in my application which is kinda CURD application. I have wriiten all the handlers in controller (for cut, read, delete operation) . Now I want to implement a default method which will get called when request cant map to any of the handler. Can anyone please tell me how to define this default request handler when none of the handler matches the given request. ?

P.S. In the documentation I could see that there is a method called "handleNoSuchRequestHandlingMethod" which one should override. Though I want to provide the loggic for default view handling in this method and name of the method does not look appropriate in that case. Or is it the only and correct way to do it ? Please explain.


Thanks in advance
Samir

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Samir,

You need to provide the value for 'defaultMethodName' property of MethodNameResolver of your MultiActionController. For instance,



That is, your 'noWhere' method has to be also on the list as well.

Good luck.
Frank
 
samir ware
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Frank
Thank you very much for the reply. It solved my problem partially. Can you please tell me how can I pass HttpServeltRequest and HttpServletResponse as parameters to the method "noWhere" ?
Thanks in advance
Samir
 
Frank Truong
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Samir,

Like other handler methods, your 'noWhere' method have to have at least HttpServletRequest and HttpServletResponse parameters. Double-check the API of MultiActionController, Samir. The 3rd parm, HttpSession, and 4th param, command object, are optional.

It is similar to 'unspecified' method in DispatchAction of Struts 1.x, I think.

Good luck.
Frank
 
reply
    Bookmark Topic Watch Topic
  • New Topic