设置PDF导出器的输出文件名

我使用的是JasperReports 5.6 我使用PDFCreator生成pdf。 我的pdf生成成功,但我无法为该PDF文件设置名称。 PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet(); printRequestAttributeSet.add(MediaSizeName.ISO_A4); PrintServiceAttributeSet printServiceAttributeSet = new HashPrintServiceAttributeSet(); printServiceAttributeSet.add(new PrinterName(“PDFCreator”, null)); JRPrintServiceExporter exporter = new JRPrintServiceExporter(); exporter.setExporterInput(new SimpleExporterInput(tempFileName)); SimplePrintServiceExporterConfiguration configuration = new SimplePrintServiceExporterConfiguration(); configuration.setPrintRequestAttributeSet(printRequestAttributeSet); configuration.setPrintServiceAttributeSet(printServiceAttributeSet); configuration.setDisplayPageDialog(false); configuration.setDisplayPrintDialog(false); exporter.setConfiguration(configuration); exporter.exportReport(); 我的pdf名称是使用该PDFCreator工具设置的 我想将名称传递给该pdf文件。 自exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, “d:/adc.pdf”); 方法现已弃用。 请告诉我如何设置该文件名的解决方案

如何在ormlite中保存带有“外来对象”的对象

这是我的数据库: CREATE TABLE other ( id integer primary key autoincrement not null, texto text ); CREATE TABLE tabela (campoid INTEGER primary key autoincrement not null, camponome text not null, chave int, foreign key (chave) references other(id)); 这是我的课程: @DatabaseTable(tableName = “tabela”) public class Bean { @DatabaseField(columnName = “campoid”, generatedId = true) private int _id; @DatabaseField(columnName = […]

在REST方法调用上上载的文件已损坏

所以我在我的Web应用程序中使用以下Rest方法来上传文件。 当我上传文本文件时,它们会正确保存,我可以打开它们。 但是在任何其他格式(即* .docx或* .pdf或* .jpg)的情况下,文件的存储大小与原始文件完全相同但已损坏。 以下是代码: @POST @Consumes(“multipart/form-data”) public Response readFile() throws IOException, ServletException { Part filePart = request.getPart(“c”); InputStream f = filePart.getInputStream(); String l = null; DataInputStream ds = new DataInputStream(f); File file = new File(“c:\\temp\\” + getSubmittedFileName(filePart)); try { BufferedWriter bw = new BufferedWriter(new FileWriter(file)); while ((l = ds.readLine()) != null) { […]

删除音频噪音

需要一种算法(或一组好的,以便比较各种输入数据),这将降低语音音频信号的噪声水平,而不会使用Java明显地扭曲信号。 输入是一种音频信号,包括声音和一些背景噪音。 噪音随着录音过程而变化。 绝对存在消除这种噪声的方法,用于语音识别和电影制作。 所需的输出是最小失真的语音信号,其背景干扰最低限度地可听到人耳。 量化标准最小化 信噪比和 总谐波失真。

Zk从选定选项卡中删除事件侦听器

我有2个选项卡,一个是父选项卡,另一个是子选项卡。我创建了父选项卡,并使用onClose事件将侦听器动态地添加到它,然后创建子选项卡。 实际上我想要当用户点击Tab的关闭按钮时,他无法关闭并获取消息,因此我将event.stopPropogation()用于处理close事件。 创建子选项卡后,应从父选项卡中删除事件侦听器。但是侦听器不会从父选项卡中删除。 因为我正在使用removeEventlistener,但它也无法正常工作。 第一次我正在调用一个方法,我将事件监听器添加到父选项卡。 mainTab.getSelectedTab().addEventListener(Events.ON_CLOSE, new EventListener() { public void onEvent(Event event) throws Exception { event.stopPropogation(); showWarning(message); return; } }); 然后在创建所有子选项卡后,我必须删除此监听器。我正在使用… mainTab.getSelectedTab().removeEventListener(Events.ON_CLOSE, new EventListener() { public void onEvent(Event event) throws Exception { } }); 这个监听器不能在这个选项卡上工作但是当我打开新选项卡(主选项卡的兄弟)时,不会调用监听器。 如何从当前标签中删除监听器? 谁能解决我的问题?

JSF在哪里validation输入值? 后端还是前端?

JSF可以validation输入值。 任何人都可以说JSF在哪里validation..?

使用Java在Play Framework 2.2.x中处理POST请求?

我开始使用Play 2.2.x,我正在尝试处理POST请求,我的理解是我不需要在conf / routes文件中指定参数,而是使用play的DynamicForm类提取查询,如下所示: import play.*; import play.api.data.Form; import play.data.DynamicForm; import play.mvc.*; import views.html.*; public static Result hello() { DynamicForm requestData = Form.form().bindFromRequest(); String firstname = requestData.get(“firstname”); String lastname = requestData.get(“lastname”); return ok(“Hello ” + firstname + ” ” + lastname); } 但是,我在Eclipse中遇到此错误: “The method form() is undefined for the type Form 当我执行“play run”时,我得到了这个编译器: error: […]

如何将Java swing黑色背景工具栏集成到polaraxes中?

代码我尝试将缩短版的Altman的MATLAB 2013极地雷达系统代码集成到MATLAB 2016b极地实现中,因为我想在工具栏中使用黑色背景并使用水平滚动条进行缩放function。 前面的代码基本上使用了具有continuous-movement callback javax.swing.JSlider 。 当前错误来自’StateChangedCallback’,{@cbSlider,fp,imax}); 其中,轴imax行为与预期不符 close all; clear all; clc; % http://stackoverflow.com/q/40030096/54964 fp=figure(‘Name’, ‘Test’, … ‘Position’,[200 200 851 404],’Resize’,’off’); % only half circle in polaraxes although warp can do eclipses ThetaTicks = 0*pi:pi/10:1*pi; pax = polaraxes( ‘ThetaAxisUnits’, ‘radians’, … ‘ThetaLim’,[min(ThetaTicks) max(ThetaTicks)],… ‘Color’,’none’,… ‘GridAlpha’,1,… ‘GridColor’,[1 1 1],… ‘ThetaTick’, ThetaTicks, … ‘ThetaDir’, ‘counterclockwise’, […]

为什么我的JFrame不会响应鼠标和窗口的变化?

这是我的代码: import java.awt.event.*; import java.awt.*; import javax.swing.*; public class wind extends JFrame implements ComponentListener, MouseListener { JButton button; JLabel label; public wind() { // initialise instance variables setTitle(“My First Window!”); setSize(400, 200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); JPanel content = new JPanel(); content.setLayout(new FlowLayout()); content.addComponentListener(this); content.addMouseListener(this); label = new JLabel(“My First Window”); content.add(label); label.addComponentListener(this); button = new JButton(“Click […]

使用jetty以编程方式安装和运行servlet测试

jetty servlet容器快速而轻便,可以在unit testing中运行(实际上我用来提供文件)。 可以通过编程方式(比如在测试中)将实际的servlet安装到其中并运行它们吗?