After using the ModelDrivernInterceptor, how to access Action properties in result JSP page?

StackOverflow https://stackoverflow.com/questions/23413665

سؤال

In Struts2, after using ModelDrivernInterceptor, the data is located in a model object,

And the model is been pushed to the ValueStack. then, after this.

How to access the Action's property?

هل كانت مفيدة؟

المحلول

Access action properties as usual if you don't have the same property's names in the model and in the action classes. If you have the same names, you can only access action properties via accessing a value stack directly by the index, like in this question and answer: Passing parameters to action through ModelDriven in Struts 2.3.16.

نصائح أخرى

Use #action.someProperty.

Using the stack index is fragile, e.g., if you change your JSP you may introduce stack depth, etc.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top