Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/360.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 从arraylist中提取聚合对象值_Java_Arraylist - Fatal编程技术网

Java 从arraylist中提取聚合对象值

Java 从arraylist中提取聚合对象值,java,arraylist,Java,Arraylist,我试图在arraylist public class FlatAddress implements Serializable{ private String flat_no; private String flat_type; private String flat_address; private int area_code; private int state_code; private UserPrintApp uPrint; //getters and setters..

我试图在
arraylist

public class FlatAddress implements Serializable{
 private String flat_no;
 private String flat_type;
 private String flat_address;
 private int area_code;
 private int state_code;

 private UserPrintApp uPrint;
 //getters and setters..
}
在第二步中,我能够将值存储在
ArrayList
中,并将
Collection
返回到我的servlet页面

Collection<FlatAddress> printAllotLetter = new ArrayList<FlatAddress>();

FlatAddress fa = new FlatAddress();
  UserPrintApp upa = new UserPrintApp();
  upa.setEmp_code(1234);
  upa.setEmp_name("EmpName");
  upa.setEmp_designation("Mgr");
  fa.setuPrint(upa);
  fa.setFlat_no("ad/1");
  fa.setFlat_address("Treemax");
  printAllotLetter.add(fa);

是否可以从集合中提取聚合对象,或者我应该准备其他集合类来执行我目前正在尝试的操作。

是的,可以,但形式如下:

${letter.uPrint.emp_code}
而不是

${letter.emp_code } <-- letter does not have emp_code property

${letter.emp_code}是的,这是可能的,但以这种形式:

${letter.uPrint.emp_code}
而不是

${letter.emp_code } <-- letter does not have emp_code property
${letter.emp_code}