• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is it OK to use struts actionMessages objects in a session bean

 
John Marchesino
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy,

I am accessing a session bean from my action class to update multiple rows in a database. In the update method I iterate through a map and use the map values to update the database. Throughout the iteration process I need to save a list of messages based on the results of each entry attempt.
I am currently doing so by populating a ActionMessages object inside of my session bean and then passing it back to the struts action to save it to the request.

My question then is this. Is it bad practice to use the ActionMessages object inside of the session bean? If so does any one know of a suitable alternative.

Thanks
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it bad practice to use the ActionMessages object inside of the session bean?

Yes. An EJB should never be aware of what the client is.

If so does any one know of a suitable alternative.

Just have the EJB method build a list of messages and return that list to Struts.
 
Schandha Ravi
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roger,

that means we need to extend ActionMessage class to build our own Message class or do you suggest any otherway of doing that.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!