类型转换的问题
public String execute() throws Exception {
/* 查询所有收费信息,按发布时间降序排列 */
OpDB myOp=new OpDB();
String sql1="select * from tb_info where (info_state='1') and (info_payfor = '1') order by info_date desc";
List payforlist=myOp.OpListShow(sql1,null);
request.setAttribute("payforlist",payforlist);
/* 查询免费信息,按发布时间降序排列 */
List allsublist=new ArrayList();
if(typeMap!=null&&typeMap.size()!=0){
Iterator itype=typeMap.keySet().iterator();
String sql2="SELECT TOP 5 * FROM tb_info WHERE (info_type = ?) AND (info_state='1') AND (info_payfor = '0') ORDER BY info_date DESC";
while(itype.hasNext()){
Integer sign=(Integer)itype.next();//就是这句报错的
System.out.println(sign);
Object[] params={sign};
List onesublist=myOp.OpListShow(sql2, params);
allsublist.add(onesublist);
}
}
request.setAttribute("allsublist",allsublist);
session.put("typeMap",typeMap);
session.put("searchMap",searchMap);
return SUCCESS;
}
}
HTTP Status 500 -
--------------------------------------------
type Exception report
message
description
The server encountered an internal error () that prevented it from fulfilling this request.exception
java.lang.ClassCastException: java.lang.String com.action.IndexAction.execute(IndexAction.java:47)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.