• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Command pattern doutb

 
Jose Jim´┐Żnez
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I use command pattern to search? I explain me:

In petstore actions are used to change the state of model or user's session but not to search. In this case action only return a Integer to the front controller in order to decide the next screen.

Could I use the actions to search. Is said that actions return information (ValueObject) to the views ?


Thanks.
 
Giju George
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can, but I recommend using a Fast Lane reader pattern.

http://java.sun.com/blueprints/patterns/FastLaneReader-detailed.html
 
Annick BOEL
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Giju,

If the FastLaneReader is a DAO accessed by a EJB, does it make sense to use a stateful EJB to save the list?
Thanks
Annick
 
Ajai
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then use VLH pattern.
 
Vishwa Bandhu
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jose,
What do you mean by the following?
"In petstore actions are used to change the state of model or user's session but not to search. In this case action only return a Integer to the front controller in order to decide the next screen."

Each action in petstore returns a Response and the response can be any serializable java object? The response object is set in the request attribute and the can be used to display result to the user.

So I don't see any reason why one cannot use this for search results. In fact if you use the VLH and get results page by page also, I think it will be passed through the EventResponse. But you can use a ViewHelper Tag libraries to connect to the Business tier and then get the results too...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic