Struts2 json requests are executed more than once

164 views Asked by At

I have some requests in my struts 2 application.

When using json request, i can see them running more than twice, even 5 times. why!

Please help!

I Have my method declared like this :

@Actions({ @Action(value = "/getelements", results = { @Result(name = "success", type = "json") }) }) public String myelements() { // getting elements here }

it is the get tha make it running again and again ?

1

There are 1 answers

0
Sumit On

Just a guess, but if your action methods start with getXXX, then the json result type will invoke that method again when it is trying to serialize the action class to json. Does that make sense?

Basically make sure that only your getter methods are prefixed with get and your action method is something else, like execXXX