Pma
Pma

Reputation: 1093

Struts 2 dynamic result type

I have read the Struts 2 documentation concerning dynamic results, but in the examples shown i can only influence result parameters, not the result type itself.

Is it possible to programatically define the result type for an action? for example: i would like to create a database which maps results (Strings) into correct types. In this case the result type is not known on the application startup, struts 2 should determine the result type (and its parameters) each time the action is executed by querying the database.

Is it possible to realize this scenario?

Upvotes: 1

Views: 828

Answers (1)

Steven Benitez
Steven Benitez

Reputation: 11055

Results can be defined in struts.xml or using annotations (conventions plugin). Both approaches require results to be configured at design time, though.

You might be able to create a custom result which acts fairly dynamic, but honestly, it doesn't seem like a good design to me. I don't follow what defining result types in a database would do for your application. Perhaps you can give some more details on what functionality you're trying to achieve, someone can provide a better answer.

Upvotes: 2

Related Questions