Richfaces树给我一个“未定义的Uncaught ReferenceError树". [英] Richfaces tree is giving me an "Uncaught ReferenceError tree is not defined"
问题描述
我相信我的问题出在某个地方的设置文件中,但是我不知道那是什么文件/设置.我有一个带有工作树的独立项目,但是当我尝试将其与实际项目集成时,我开始遇到上述错误.这就是让我认为我在某个地方无法使用的设置的原因. 我正在使用JSF1.2和richfaces 3.3.3.这是我的JSP文件.
I believe my problem is in a settings file somewhere, but I have no idea what file/setting that would be. I have a standalone project with a working tree, but when I try to integrate it with my real project I start getting the mentioned error. That's what makes me think I have a setting somewhere that's off. I'm using JSF1.2 and richfaces 3.3.3. Here's my JSP file.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%-- jsf:pagecode language="java" location="/src/java/pagecode/agencyMappingPages/mapping/Mapping.java" --%><%-- /jsf:pagecode --%>
<%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>
<html>
<f:view>
<body>
<rich:tree switchType="client" value="#{mappingBean.nodes}" var="node">
</rich:tree>
</body>
</f:view>
</html>
这是我的bean代码:
Here's my bean code:
public TreeNode<String> getNodes() {
TreeNodeImpl<String> nodes = new TreeNodeImpl<String>();
TreeNodeImpl<String> root = new TreeNodeImpl<String>();
root.setData("Test Tree Root");
nodes.addChild(0, root);
return nodes;
}
我正在使用以下罐子.这也是我在树的运行版本中使用的三个jar.
I'm using the following jars. These are also the three jars I'm using in the functioning version of my tree.
richfaces-api-3.3.3.Final.Jar
richfaces-impl-3.3.3.Final.Jar
richfaces-ui-3.3.3.Final.Jar
我的web.xml文件中包含以下内容.
I've got the following in my web.xml file.
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>-1</load-on-startup>
</servlet>
<servlet>
<servlet-name>JavaScript Resource Servlet</servlet-name>
<servlet-class>com.ibm.faces.webapp.JSResourceServlet</servlet-class>
<load-on-startup>-1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Tiles2Servet</servlet-name>
<servlet-class>org.apache.tiles.web.startup.TilesServlet</servlet-class>
<init-param>
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/tiles20-defs.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>JavaScript Resource Servlet</servlet-name>
<url-pattern>/.ibmjsfres/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
不确定这是否会有所帮助,但这是它所阻塞的javascript.我不得不省略很多,因为表单不会提交.我从Chrome的开发人员窗口复制了此内容.它在第二行引发异常:var tree = new tree ...
Not sure if this'll be helpful, but here's the javascript it chokes on. I had to omit quite a bit because the form wouldn't submit. I copied this from Chrome's developers window. It throws the exception at the second line: var tree = new tree......
<script type="text/javascript">(function() {
var tree = new Tree("j_id_jsp_1558828084_1", "j_id_jsp_1558828084_1:input", "client",
{
onselect: "",
onexpand: "",
oncollapse: "",
oncontextmenu: ""
},
function(event) {var params = {'j_id_jsp_1558828084_1:selectedNode':event.selectedNode} ;
if (!params.ajaxSingle && event.ajaxSingle) {
params.ajaxSingle = event.ajaxSingle;
}
那么,我缺少什么必要的文件/设置? 我确定我忘记了最重要的信息,这就是为什么我需要你. 谢谢, 戴尔
So, what necessary file/setting am I missing? I'm sure I'm forgetting the most important piece of info which is why I need you. Thanks, Dale
推荐答案
所以我弄清楚了问题所在.由于某些原因,Richfaces没有将脚本或样式文件发送到浏览器.它动态地将链接放在头部. 因此,我将以下过滤器添加到web.xml文件中,包括我和我的伴侣在内的一切现在都很开心.
So I figured out what the problem was. For some reason Richfaces was not sending the script or styling files to the browser. It dynamically puts the links in the head. So I add the following filters to the web.xml file and everything is happy now including me and my partner.
<context-param>
<param-name>org.richfaces.LoadStyleStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadScriptStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
希望这对其他人有帮助.
Hopefully this helps someone else.
这篇关于Richfaces树给我一个“未定义的Uncaught ReferenceError树".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!