Multiple result types in Struts2?

我是研究僧i 提交于 2019-12-02 04:56:13

To my knowledge there is no way to return multiple things simultaneously. The browser will only be expecting one thing, either the JSON or the HTML once all the tiles stuff is done.

I can think of two ways to do this: double request (one for each result type) or use one to generate the other (get the JSON and use JavaScript to construct the HTML on the client).

What are you trying to accomplish that you need both results?

create a new result type for Tiles+JSON & use it... you can't define 2 result types in a result tag.

Arthur Neves

How about if u have 2 diff results?!

<result name="successJSON" type="json"/>

<result name="successTiles" type="tiles">tiles.home</result>

then in your server code u just route to the right one?!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!