现在我的 xml配置是这样的: <action name="detailReport" method="detailReport" class="com.pracbiz.action.Detail">
<result name="success" type="jasper">
<param name="location">/WEB-INF/jasper/detail_User.jasper</param>
<param name="dataSource">detailUserList</param>
<param name="format">PDF</param>
</result>
</action>
Action类中的action这样的 public String detailReport(){
String checkbox[]=request.getParameterValues("checkbox");
for(int i=0;i<checkbox.length;i++){
int userOid=Integer.parseInt(checkbox[i]);
//cUserList=new ArrayList();
detailUserList =service.getOneUserByUserOid(userOid);//直接在数据库中查询 放在List中 能打印出数据
//cUserList =service.getOneUserByUserOid(userOid);//但是我想,打出两个值啊 ,于是用循环,结果PDF能显示有几条 记录 但是不能显示记录中的详细内容,都是NULL 所以很奇怪啊,有什么办法解决呢。。 // detailUserList.add(cUserList);
}
System.out.println(detailUserList);
System.out.println(detailUserList.size());
System.out.println("%%%%%%%%%%%%%%%%%%%%%%%");
try {
System.out.println("**********************");
String reportSource = ServletActionContext.getServletContext()
.getRealPath("/WEB-INF/jasper/detail_User.jrxml");
File parent = new File(reportSource).getParentFile();
JasperCompileManager.compileReportToFile(reportSource, new File(
parent, "detail_User.jasper")
.getAbsolutePath()); }catch (Exception e) {
System.out.println("55555555555");
e.printStackTrace();
return "exception";
}
return SUCCESS;
}问题 :注释中!
<result name="success" type="jasper">
<param name="location">/WEB-INF/jasper/detail_User.jasper</param>
<param name="dataSource">detailUserList</param>
<param name="format">PDF</param>
</result>
</action>
Action类中的action这样的 public String detailReport(){
String checkbox[]=request.getParameterValues("checkbox");
for(int i=0;i<checkbox.length;i++){
int userOid=Integer.parseInt(checkbox[i]);
//cUserList=new ArrayList();
detailUserList =service.getOneUserByUserOid(userOid);//直接在数据库中查询 放在List中 能打印出数据
//cUserList =service.getOneUserByUserOid(userOid);//但是我想,打出两个值啊 ,于是用循环,结果PDF能显示有几条 记录 但是不能显示记录中的详细内容,都是NULL 所以很奇怪啊,有什么办法解决呢。。 // detailUserList.add(cUserList);
}
System.out.println(detailUserList);
System.out.println(detailUserList.size());
System.out.println("%%%%%%%%%%%%%%%%%%%%%%%");
try {
System.out.println("**********************");
String reportSource = ServletActionContext.getServletContext()
.getRealPath("/WEB-INF/jasper/detail_User.jrxml");
File parent = new File(reportSource).getParentFile();
JasperCompileManager.compileReportToFile(reportSource, new File(
parent, "detail_User.jasper")
.getAbsolutePath()); }catch (Exception e) {
System.out.println("55555555555");
e.printStackTrace();
return "exception";
}
return SUCCESS;
}问题 :注释中!
1
%%%%%%%%%%%%%%%%%%%%%%%
**********************
不管 怎么样Action中 List都有值
到PDF中就NULL了
欢迎加入