-2

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 ?

Biggg Jimmm
  • 67
  • 2
  • 12
  • Post action configuration and stacktrace. – Aleksandr M Aug 26 '13 at 19:39
  • @Actions({ @Action(value = "/get_result", results = { @Result(name = "success", type = "json") }) }) – Biggg Jimmm Aug 26 '13 at 20:05
  • and the stacktrace does not display any error. it works fine, but more than once at evry request – Biggg Jimmm Aug 26 '13 at 20:05
  • and my json classes are declared in struts.xml like follow : – Biggg Jimmm Aug 26 '13 at 20:07
  • Edit the question, don't try to wedge stuff into comments. Without knowing **how you're making the requests** how could we begin to help? S2 won't randomly process a single request over and over. – Dave Newton Aug 26 '13 at 20:19
  • Actually, What is a question? – Roman C Aug 27 '13 at 08:55
  • Still completely unhelpful. S2 will not randomly process the same request over and over again. Please be *specific*, including **how you're making the request**, what's **actually running multiple times** (e.g., the action itself? Getters?) If the action *itself* is running multiple times then it's almost certain the request is being *made* multiple times. – Dave Newton Aug 27 '13 at 14:30

1 Answers1

0

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

Sumit
  • 1,661
  • 1
  • 13
  • 18