Lopakhin
Lopakhin

Reputation: 299

Struts json result includeProperties regex not working with root present

This question has been asked several times around struts community, the scenario is simple :If you specify

<param name="root">
myLists               
</param>    

in json result definition, the includeProperties won't work if I specify some regEx like this one:

 <param name="includeProperties">
   .*\.movieId,
    .*\.filmName
  </param>

the regex is proposed in here,plain field name won't work either.

if I remove root definition ,I can get the JSON ok but with additional JSON traversing which is undesiralbe.

So, is there any solution fix this problem? thx.

Upvotes: 1

Views: 914

Answers (1)

mtlx
mtlx

Reputation: 218

<param name="includeProperties">
 \[\d+\]\.movieId,
 \[\d+\]\.filmName
</param>

should do the trick.

Raising the log level to DEBUG for org.apache.struts2.json helped me clarifying this one.

Upvotes: 3

Related Questions