/**
* 处在开放注册期内的代理订单
* @param keyword 产品名称关键词
* @param intAllCount 返回的总条数
* @param pageindex 当前页索引(翻页时用,从0开始)
* @param pagesize 每页显示条数
* @return
*/
public static List<String[]>getOpenProductList(String keyword, int pageindex, int pagesize, Holder<Integer> AllCount)
{
int stringSize =10;//返回数组长度
List<String[]> list = new ArrayList<String[]> ();
List<String> tempList = new ArrayList<String> ();
Agent_JBTMClient client = new Agent_JBTMClient();
Agent_JBTMSoap service = client.getAgent_JBTMSoap();
ArrayOfArrayOfString tempArrayList = (ArrayOfArrayOfString) service.Get_OpenList(keyword, pageindex, pagesize, AllCount);
//计算总页
int totalPage;
if(AllCount.value%pagesize == 0)
{
totalPage = AllCount.value/pagesize;
}
else
{
totalPage = AllCount.value/pagesize+1;
}
//判断数据量
int count;
if(pageindex == totalPage-1)
{//最后一页
count =AllCount.value%pagesize;
}
else
{
count =AllCount.value<pagesize?AllCount.value:pagesize;
}
if(AllCount.value>0)
{
for(int i=0; i<count; i++)
{
String[] tempString = new String[stringSize];
tempList = tempArrayList.getArrayOfString().get(i).getString();
for(int j=0; j<stringSize; j++)
{
tempString[j] = tempList.get(j);
}
list.add(tempString);
}
}
return list;
}
此代码循环显示的,之所以抛java.lang.IndexOutOfBoundsException: Index: 7, Size: 7
异常是因为int stringSize =10;//返回数组长度(接受10个字段值显示,结果net只传给我7个字段值。)
总数据一共13条,再循环显示7条数据就会出现问题了。