views:

37

answers:

0

How do I pass a list of integers using the s:a href and param tags in Struts 2?

Example POJO:

private List<Integer> myList = new ArrayList<Integer>();

public List<Integer> getMyList() {
    return myList;
}

public void setMyList(List<Integer> myList) {
    this.myList = myList;
}

Example JSP Page:

<s:url id="testUrl" action="testAction">
   <s:param name="myList" value="%{myList}" />
</s:url>
<s:a href="%{testUrl}">Test Link</s:a>

When I click on the "Test Link", the form submits the following for myList:

[1,+2,+3,+4,+5]

This results in Struts re-directing to the "input" page. This is not the desired behavior. Does anyone have any suggestions about how to pass a list of integers correctly using the Struts tags?