这与以下问题类似:
问题A
在struts.xml
中,我有:
<action name="exportReferences" class="manageRefAction" method="exportReferences">
<result name="success" type="stream">
<param name="contentType">application/vnd.ms-excel;charset=utf-8</param>
<param name="contentDisposition">contentDisposition</param>
<param name="inputName">excelStream</param>
<param name="bufferSize">1024</param>
</result>
(...)
</action>
然后,在ManagereSection
类中,我有:
private InputStream excelStream;
public InputStream getExcelStream() {
return this.excelStream;
}
public String exportReferences() {
List<ReferenceData> referenceXLSList = null;
String exportFilename = null;
String filename = "";
String retrunStr = process();
Map session = (Map) ActionContext.getContext().get("session");
if (retrunStr.equalsIgnoreCase(ActionSupport.LOGIN)) {
setLog("2");
return LOGIN;
} else {
//Export only data with user's locale
ArrayList userLocale = (ArrayList) session.get("userLocale");
List<ArrayList> list = Arrays.asList(userLocale);
try {
referenceXLSList = referenceDataService.fetchReferenceDataXls();
// Data filtering
for (Iterator<ReferenceData> iterator = referenceXLSList.iterator(); iterator.hasNext(); ) {
ReferenceData ref = iterator.next();
String l = ref.getLocal().toLowerCase();
if (!userLocale.contains(l)) {
iterator.remove();
}
}
if (referenceXLSList.isEmpty()) {
return INPUT;
}
ServletContext servletContext = ServletActionContext.getServletContext();
String exportFolderPath = servletContext.getRealPath("/files" + "/xls");
File folder = new File(exportFolderPath);
// Creation of the folder if it is not existing
if (!folder.exists())
folder.mkdirs();
exportFilename = PLConstants.REF_SHEET_NAME + PLConstants.XLS_FILE_EXTENSION;
filename = exportFolderPath + "/" + exportFilename;
File file = new File(filename);
file.createNewFile();
ExcelWriter writer = new ExcelWriter();
Workbook wb = writer.writeRefData(filename, exportFilename, referenceXLSList);
setContentDisposition("attachment; filename=" + exportFilename);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
wb.write(baos);
this.excelStream = new ByteArrayInputStream(baos.toByteArray());
return SUCCESS;
} catch (Throwable e) {
e.printStackTrace();
logger.info("Exception while exporting partner references", e);
return INPUT;
}
}
}
试一下,ContentDisposition
是struts.xml中没有得到的字符串值。在param中使用以下语法${contentDisposition}
<action name="exportReferences" class="manageRefAction" method="exportReferences">
<result name="success" type="stream">
<param name="contentType">application/vnd.ms-excel;charset=utf-8</param>
<param name="contentDisposition">${contentDisposition}</param>
<param name="inputName">excelStream</param>
<param name="bufferSize">1024</param>
</result>
(...)
</action>
问题内容: 我有5个表,每个表与下一个表有一对多的关系 。project_t-> project_level1_t-> project_level2_t-> project_level3_t-> project_level4_t 我想让用户hibernate这些表 和project_level1_t 和project_level2_t 这是存储库文件 和 和 但是当我运行我的应用程序时,出现此错误
冬眠5.2.12.1决赛 我想用CriteriaBuilder替换depreracted session.createCriteria(参见org.hibernate.Criteria),我有以下异常 在此ManagedType[com…DonneReference]上找不到具有给定名称[filtre]的属性 上: 其中(builder.equal(root.get(“filter”),filte
问题内容: 您好我的表格如下: 1- medical_company : account_entity* 表 account_entity_id 列上的medical_company_id 外键 (不是pk) *** 第1栏 专栏2 第三栏 2- account_entity : account_entity_id (pk) 第1栏 专栏2 第三栏 3 人同行: person_id (pk) 第1
我试图提供应用程序在Spring与懒惰取实体之间的关系。 模型"用户": “跟踪器”模型 继承了带有@EntityGraph的JPA存储库。通过这一点,我试图为select用户提供与以下相关的所有跟踪器: 存储库类: 和控制器: 查询“/customers/1”可以正常工作。它返回没有跟踪器的所有客户(相应地,延迟获取)。 但是"/顾客/1/with Tracker"返回以下异常:
这是我的工作树 我已经搜索了这个问题,但我还没有弄清楚问题是什么。救命啊!