Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Refre to form(command) object in MultiActionController

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

Could you tell me how I can refer to form(command) object from my MultiActionController object?

Thanks.
Frank
 
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
Hi,

I was able to get it to work. I should have a bean whose properties match form properties. Then, I just need to pass this object as 3rd param(or after session param if one is present) into the method discussed in MultiActionController's api. Bean properties should be bound automatically by request's properties. It works pretty much like ActionForm in Struts.

Please correct me if my understanding is not right.

Thanks.
Frank
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure if can you use 4th param (after session), because from the JavaDoc we're supposed to use 3rd param for a command object or session.

May take a third parameter (of type HttpSession) in which an existing session will be required, or a third parameter of an arbitrary class that gets treated as the command (that is, an instance of the class gets created, and request parameters get bound to it)


http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/servlet/mvc/multiaction/MultiActionController.html

Anyway, MultiActionController is similar to a Struts DispatchAction.
 
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
Hi,

According to the api, you're totally correct.

I could not wait for this myth to be solved. I ran a test in which command object was passed as 4th param(after 3rd param session) and it worked the same way as being passed as 3rd param - properties got bound with form properties normally.

I think this is just the ordinary method that we would implement in controller layer and configure its name(and only name) in configuration file.

In fact, I have seen some urls in this forum that link to sample codes of MultiActionController where command object being passed as 3rd or 4th param.

Frank

 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the update. This is new to me.
 
Looky! I'm being abducted by space aliens! Me and this tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic