Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Design struts 2

 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! In my webapplication a user can list items in a db. The Items can be fetched in many numerous ways. By brand, by category, subcategory, department etc. The view looks exactly the same but the top is slightly different.

When the items is viewed a user can filter the items to be more specific. The problem is I don't know exactly on how to design the Action class. Should I use one action class that has get,set for brand, department etc and check if the parameter is empty or what is the normal approach?

Sould I have a diffrent Action class when Brand, Department, Subcategory ( in a droplist in the view ).

Any suggestions
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like all the business logic can be in your pojo class/es, and there can be only 1 action class.
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I constructs this action class? A lot of sets and gets? But I need to do all the quering from the action class



Is this correct?
 
Wes Wannemacher
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not completely sure it would help you, but have you looked at the Displaytag library? displaytag.sourceforge.net/11/

A flexible action that can sort and filter as loosely as you describe would be pretty difficult to maintain. I would look to see if you could retrofit your problem into using displaytag and you'll be happy you did.

-Wes
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic