假设我有一个看起来像这样的对象:
我希望能够添加包含类似数据的多个public class C {
public static void main() {
try {
File file = new File("C:\\Users\\Sumuel\\Desktop\\Query.xls");
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("C.info");
//Create Heading
Row rowHeading = sheet.createRow(0);
rowHeading.createCell(0).setCellValue("Name");
rowHeading.createCell(1).setCellValue("Email");
rowHeading.createCell(2).setCellValue("Address");
rowHeading.createCell(3).setCellValue("Phone");
for (int i = 0; i < 4; i++){
CellStyle styleHeading = workbook.createCellStyle();
Font font = workbook.createFont();
font.setBold(true);
styleHeading.setFont(font);
rowHeading.getCell(i).setCellStyle(styleHeading);
}
for(int i = 0; i<4; i++){
sheet.autoSizeColumn(i);
}
Customer c1;
Row custInfo = sheet.createRow(1);
custInfo.createCell(0).setCellValue(c1.getName());
custInfo.createCell(1).setCellValue(c1.getEmail());
custInfo.createCell(0).setCellValue(c1.getAddress());
custInfo.createCell(1).setCellValue(c1.getPhone());
FileOutputStream out = new FileOutputStream(new File("C:\\Users\\Sumuel\\Desktop\\Query.xls"));
workbook.write(out);
out.close();
workbook.close();
System.out.println("file written");
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
属性部分。但是,我不确定在正常的Javascript行为下是否允许这样做。什么是解决这个问题的最佳方法?
答案 0 :(得分:2)
javascript中的属性名称必须是唯一的!
你想要的,例如,一个&#34;属性部分&#34;对象:
redirect_to charges_shipping_path and return