File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Design struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Design struts 2" Watch "Design struts 2" New topic

Design struts 2

Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
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

Joined: Feb 26, 2005
Posts: 2068
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

Joined: Aug 21, 2004
Posts: 367
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

Joined: Jul 07, 2007
Posts: 13
I am not completely sure it would help you, but have you looked at the Displaytag library?

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.


Discussion of Java, Struts, Spring, Hibernate, etc. <a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: Design struts 2
jQuery in Action, 3rd edition