So far, I've been able to send a simple string to a Struts2 action class, via an AJAX call. This time I need to do the same, but with a String array, and so I've changed my code like this:
1. AJAX call:
var test = [1, 2, 3, 4, 5];
$.ajax({
method: "POST",
url: "createexperiment4.action",
data: { test : test },
success:
function()
{
window.location = "loadexperiments.action";
}
});
2. CreateExperiment4Action.java:
private String[] test;
[...]
public void setTest(String[] test)
{
this.test = test;
}
However, the data isn't arriving to the action calss. Also, I keep getting this warning, which of course must be the key to my problem:
WARNING: Parameter [test[]] didn't match acceptedPattern pattern!
Maybe this is some kind of configuration issue?