gpt4 book ai didi

jsf - 警告: JSF1091: No mime type could be found for file dynamiccontent

转载 作者:行者123 更新时间:2023-12-04 13:51:53 25 4
gpt4 key购买 nike

我在eclipse下收到以下警告:

WARNING: JSF1091: No mime type could be found for file dynamiccontent. To resolve this, add a mime-type mapping to the applications web.xml

发布图片时导致此错误

在primefaces Composer 下面:
<p:graphicImage  value="#{bean.image}"/>

Java Bean:
private StreamedContent image;

// Getter
public StreamedContent getImage() {
try {
JFreeChart jfreechart = ChartFactory.createPieChart3D("",
createDataset(), true, true, false);

PiePlot3D plot = (PiePlot3D) jfreechart.getPlot();

File chartFile = new File("dynamichart");
ChartUtilities.saveChartAsPNG(chartFile, jfreechart, 375, 300);
chartImage = new DefaultStreamedContent(new FileInputStream(
chartFile), "image/png");
return chartImage;
} catch (Exception e) {
e.printStackTrace();
return new DefaultStreamedContent();
}
}

// generate data for image
public static PieDataset createDataset() {
DefaultPieDataset dataset = new DefaultPieDataset();
dataset.setValue("A",10);
dataset.setValue("B", 11);
dataset.setValue("C", 80);
dataset.setValue("D", 12);
return dataset;
}

最佳答案

尝试将以下内容添加到您的web.xml文件中

<mime-mapping>
<extension>jsp <!--{or the extension of file}--></extension>
<mime-type>text/html</mime-type>
</mime-mapping>

关于jsf - 警告: JSF1091: No mime type could be found for file dynamiccontent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14984154/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com