我的要求是根据从数据库中检索的数据动态填充图表。包括的罐子如下:
flamingo-service-jsf-1.6.1-SNAPSHOT.jar
amf-serializer-1.6.1-SNAPSHOT.jar
common-annotations.jar
commons-beanutils.jar
commons-collections.jar
commons-digester.jar
commons-logging.jar
el-api-1.0.jar
el-impl-1.0.jar
fiji-api-1.0.0.jar
fiji-ui-1.0.0.jar
jsf-api-1.2_09.jar
jsf-facelets-1.1.14.jar
jsf-impl-1.2_09.jar
jstl-1.2.jar
laguna.jar
richfaces-api-3.2.2.CR3.jar
richfaces-impl-3.2.2.CR3.jar
richfaces-ui-3.2.2.CR3.jar
standard.jar
My Bean如下:
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Random;
public class GraphBean {
private Integer data;
private Map<String, Integer> monthMap = new LinkedHashMap<String,Integer>();
private ArrayList<String> names = new ArrayList<String>();
private ArrayList<String> colors = new ArrayList<String>();
Random rnd = new Random(new Date().getTime());
public GraphBean() {
super();
generateData();
}
private void generateData() {
monthMap.put("January", getData());
monthMap.put("February", getData());
monthMap.put("March", getData());
}
public Map<String, Integer> getMonthMap() {
return monthMap;
}
public ArrayList<String> getNames(){
names.add("Motherboards");
return names;
}
public ArrayList<String> getColors(){
colors.add("#5db2c2");
return colors;
}
public Integer getData() {
data = rnd.nextInt(50);
return data;
}
}
我的jsp页面如下:
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://exadel.com/fiji" prefix="fiji" %>
<html>
<head>
<title>enter your name page</title>
</head>
<body> <f:view>
<fiji:columnChart id="columnChartOne" value="#{GraphBean.monthMap}" title="One-series Column Chart" barCaption="none"
barColors="#{GraphBean.colors}" captionX="Months" captionY="Amount" toolTipValue="{y} {name} are sold in {x}"
subtitle="Hardware sales per month" width="400" height="400">
<fiji:chartData type="name" value="#{GraphBean.names}" />
</fiji:columnChart>
</f:view>
</body>
</html>
在遇到任何一个execption后执行页面。
1. org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to load class for JSP
2. org.apache.jasper.JasperException: The absolute uri: http://exadel.com/fiji cannot be resolved in either web.xml or the jar files deployed with this application
请建议我一个解决方案。我在过去两周内使用jsf标签在jsp页面中尝试动态图表。
答案 0 :(得分:0)
来自this article:
...
在下一步中,您将要将lib文件夹中的JAR文件复制到 斐济/ web / WEB-INF / lib目录
1.如果运行Tomcat 5.5,请复制所有文件
2.如果您运行的是Tomcat 6,请复制除之外的所有文件:
* el-api.1.0.jar
* el-impl-1.0.jar
您是否在web.xml
文件中配置了taglib?像:
<taglib>
<taglib-uri>http://exadel.com/fiji</taglib-uri>
<taglib-location>/WEB-INF/lib/jstl-1.2.jar</taglib-location>
</taglib>
如果是这样,请尝试对其进行评论,如文章“无需其他任何内容”所示:
...
而已。不需要任何其他内容,甚至不需要更改web.xml