Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法为一个动作类加载多个 ModelDriven 模型或在 struts2 中的一个动作类上切换模型?
ModelDriven您可以通过使用返回任意对象ModelDriven<Object>。这通常在 CRUD 操作中用于返回域对象列表或单个域对象。
ModelDriven
ModelDriven<Object>
或者,模型对象可以由其他对象组合而成,例如,aUserModel可能同时具有List<User>和User属性,每个都在适当的时候填充数据。但是,属性不需要是相同的类型,因此模型可能具有User属性和Headlines 列表或其他内容。
UserModel
List<User>
User
Headline