MyActionListener.java:8: 软件包 javax.faces.tree 不存在
import javax.faces.tree.Tree;已经将 jsf-api.jar 放在jdk 的lib 目录下,也添加到了classpath中,能找到
javax.faces.component.UIComponent
打开jsf-api.jar jsf-ri.jar jsf-impl.jar中都找不到javax.faces.tree.Tree
求高手解答啊 。。这是我的第一个JSF例子。。代码。。
package ch01a;import java.util.Iterator;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.ActionListener;
import javax.faces.tree.Tree;public class MyActionListener
{
public PhaseId getPhaseId(){
System.out.println("getPhaseId called..");
return PhaseId.APPLY_REQUEST_VALUES;
} public void processAction(ActionEvent event){
System.out.println("processAction called");
//the componet that trigegered the action event
UIComponent component =event.getComponent();
System.out.println(
"The id of the component that fired the action event:"
+component.getComponentId());
//the action command
String actionCommand=event.getActionCommand();
System.out.println("Action command :"+actionCommand); FacesContext facesContext=FacesContext.getCurrentInstance();
Tree tree=facesContext.getTree();
UIComponent root=tree.getRoot();
System.out.println("---------Component Tree------------");
navigateComponentTree(root,0);
System.out.println("-----------------------------------");
} private void navigateComponentTree(UIComponent root,int level){
//indent
for(int i=0;i<level;i++){
System.out.print(" ");
//print component id
System.out.println(component.getComponentId());
Iterator children=component.getChildren();
//navigate children
while(children.hasNext){
UIComponent child=(UIComponent)children.next();
navigateComponentTree(child,level+1);
}
} }
}
import javax.faces.tree.Tree;已经将 jsf-api.jar 放在jdk 的lib 目录下,也添加到了classpath中,能找到
javax.faces.component.UIComponent
打开jsf-api.jar jsf-ri.jar jsf-impl.jar中都找不到javax.faces.tree.Tree
求高手解答啊 。。这是我的第一个JSF例子。。代码。。
package ch01a;import java.util.Iterator;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.ActionListener;
import javax.faces.tree.Tree;public class MyActionListener
{
public PhaseId getPhaseId(){
System.out.println("getPhaseId called..");
return PhaseId.APPLY_REQUEST_VALUES;
} public void processAction(ActionEvent event){
System.out.println("processAction called");
//the componet that trigegered the action event
UIComponent component =event.getComponent();
System.out.println(
"The id of the component that fired the action event:"
+component.getComponentId());
//the action command
String actionCommand=event.getActionCommand();
System.out.println("Action command :"+actionCommand); FacesContext facesContext=FacesContext.getCurrentInstance();
Tree tree=facesContext.getTree();
UIComponent root=tree.getRoot();
System.out.println("---------Component Tree------------");
navigateComponentTree(root,0);
System.out.println("-----------------------------------");
} private void navigateComponentTree(UIComponent root,int level){
//indent
for(int i=0;i<level;i++){
System.out.print(" ");
//print component id
System.out.println(component.getComponentId());
Iterator children=component.getChildren();
//navigate children
while(children.hasNext){
UIComponent child=(UIComponent)children.next();
navigateComponentTree(child,level+1);
}
} }
}
解决方案 »
- java 读取excel
- Spring配置了AOP实现自动代理。但是没效果。。求解疑。。
- Struts2访问请求路径问题:
- 如何在struts的html标签中加入事件
- 提一个弱智的问题:访问数据类的写在哪里?
- jsp如何不使用标签获得webwork如何将处理结果?
- TOMCAT里面怎么使用数据库连接池?是不是要自己写代码的,还有TOMCAT有这样的功能可用
- 求简单的源代码....(机j2ee模式开发web程序,简单的,可运行就行,分不够,可以在加!,帖子也可以啊!)
- 初学EJB,就遇到一个问题,请各位多多指教!!高分!!!!
- 我用JB7写CMP直接向weblogic发布,在weblogic中已经定义好连接池,发布时出错,请相帮
- Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]将截断字符串或二进制数据
- ssh框架中的问题
不知道怎么回事? 你能编译过去这个类吗?