1

I follow the example listed here when I load the page or press any button on the grid the method execute is called twice. I want to call it just once. What can I do?

rvazquezglez
  • 2,284
  • 28
  • 40

1 Answers1

2

Rename (or remove, since in the example is not used) the getJSON method.

public String getJSON()
{
   return execute();
}

JSON plugin may be calling all your methods that start with "get" in an attempt to serialize them for output.

See: Struts2 Action being called twice if result type is json

Edit:

You can also use the includeProperties or excludeProperties params to avoid the default behavior of call all the methods that start with "get", see: Problem with Json plugin in Struts 2

Community
  • 1
  • 1
rvazquezglez
  • 2,284
  • 28
  • 40