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

Struts2 Design Question - Solid Opinions Needed...

JJ Jones

Joined: Sep 09, 2004
Posts: 2

My environment: Struts2, Spring, Annotated Hibernate, Sitemesh

I have a subclass hierarchy in my Hibernate "model"....

+SomeCustomProduct (extends Product)
+AnotherCustomProduct (extends Product)

I want to create an "extendable" user interface/action design that can quickly allow me to create new views for addtional custom products. These custom products need to have validation on certain fields etc.

Here is what I was thinking...

- Create an abstract "ProductAction" that handles the simple stuff
- Create a concrete "SomeCustomProductAction", that handles the saving etc.

The issue is that I need to have a new set of views for the "CustomProduct" so I can capture that information, however, I am finding that when I go down this road, my struts.xml is getting quite complex.

Is there a way in Struts "out of the box" to handle this? Are there any approaches anyone can propose to make extending "actions/views" easier?

Thanks in advance!

David Newton

Joined: Sep 29, 2008
Posts: 12617

Without knowing more I'd point you first at wildcards in results, and dynamic result parameters, which can be used to pass action properties to result configuration.
I agree. Here's the link:
subject: Struts2 Design Question - Solid Opinions Needed...
It's not a secret anymore!