0

I have an application in which I am using tiles, but I am using ajax request too to get the response of type json and want to display it through tiles. Can I set both result-types in my struts.xml.

I have tried this but failed...

<action name="*CampData" method="{1}" class="com.contaque.monitor.CampAction">
        <result name="get" type="tiles+json">getCampData</result>
    </action>

is there any solution to this???

earthmover
  • 4,395
  • 10
  • 43
  • 74

4 Answers4

0

I think it's not possible. Please go through the below link for more understanding.

Multiple result types in Struts2?

Hope it'll help you.

Thnaks.

Community
  • 1
  • 1
0

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

Lijo
  • 6,498
  • 5
  • 49
  • 60
0

I faced the same problem. My final answer is: you don't need it. You must define two different results, one with "tiles" and another one with "json". The problem arise, in my case, using jTable. You need something like this:

<action name="seeCampDataGrid">
    <result name="get" type="tiles">getCampData</result>
</action> <!-- this load the jsp, probably with no data -->
<action name="*CampData" method="{1}" class="com.contaque.monitor.CampAction">
    <result name="get" type="json" />
</action> <!-- this will load data within the jsp. No jsp is needed. -->
luca.vercelli
  • 898
  • 7
  • 24
0

mr. you need not to use result type="tiles" when you are going to use ajax implementation, use "tiles" result type only when you need to open another page or you want to show your result on another .jsp page! hope you will understand what i am saying