Xpages-如何在页面上找到组件的ID?

时间:2018-12-13 16:24:39

标签: xpages

我的openLog数据库中出现很多错误:

  

表达语言解释异常错误:'compositeData'不是   找到-_id773上的错误:

     

解释异常

     

错误:找不到“ compositeData”

多次,每次使用不同的ID。如果我查看源代码并搜索任何ID,则在任何地方都找不到它们...。有什么可以跳出方向的提示吗?我假设的错误是因为我在不存在的某个地方引用了CompositeData属性,但是我有这么多的自定义属性,其中包含大量自定义控件,因此很难查明。即使有人可以在堆栈中看到跟踪的字段类型,也可以帮助我缩小范围。谢谢

堆栈跟踪:

  

堆栈跟踪com.ibm.jscript.InterpretException:在以下位置解释异常   com.paulwithers.openLog.OpenLogErrorHolder.getInterpretException(OpenLogErrorHolder.java:114)   在   com.paulwithers.openLog.OpenLogErrorHolder.addError(OpenLogErrorHolder.java:216)   在sun.reflect.GeneratedMethodAccessor35.invoke(未知来源)   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)   在java.lang.reflect.Method.invoke(Method.java:508)在   com.ibm.jscript.types.JavaAccessObject.call(JavaAccessObject.java:322)   在com.ibm.jscript.types.FBSObject.call(FBSObject.java:161)处   com.ibm.jscript.ASTTree.ASTCall.interpret(ASTCall.java:197)在   com.ibm.jscript.ASTTree.ASTTry.interpretCatch(ASTTry.java:150)在   com.ibm.jscript.ASTTree.ASTTry.interpret(ASTTry.java:113)在   com.ibm.jscript.ASTTree.ASTProgram.interpret(ASTProgram.java:119)位于   com.ibm.jscript.ASTTree.ASTProgram.interpretEx(ASTProgram.java:139)在   com.ibm.jscript.JSExpression._interpretExpression(JSExpression.java:435)   在com.ibm.jscript.JSExpression.access $ 1(JSExpression.java:424)处   com.ibm.jscript.JSExpression $ 2.run(JSExpression.java:414)在   java.security.AccessController.doPrivileged(AccessController.java:686)   在   com.ibm.jscript.JSExpression.interpretExpression(JSExpression.java:410)   在com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:251)   在com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:234)   在   com.ibm.xsp.javascript.JavaScriptInterpreter.interpret(JavaScriptInterpreter.java:222)   在   com.ibm.xsp.javascript.JavaScriptInterpreter.interpret(JavaScriptInterpreter.java:194)   在   com.ibm.xsp.binding.javascript.JavaScriptValueBinding.getValue(JavaScriptValueBinding.java:78)   在   com.ibm.xsp.component.xp.XspOutputLabel.getFor(XspOutputLabel.java:158)   在sun.reflect.GeneratedMethodAccessor25.invoke(未知来源)在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)   在java.lang.reflect.Method.invoke(Method.java:508)在   javax.faces.component.UIComponentBase $ AttributesMap.put(UIComponentBase.java:1863)   在   com.ibm.xsp.stylekit.StyleKitImpl.applyProperties(StyleKitImpl.java:391)   在com.ibm.xsp.stylekit.StyleKitImpl.applyStyle(StyleKitImpl.java:240)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:196)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl._applyStyles(StyleKitImpl.java:203)   在   com.ibm.xsp.stylekit.StyleKitImpl.applyStyles(StyleKitImpl.java:192)   在   com.ibm.xsp.application.ViewHandlerEx.applyStyles(ViewHandlerEx.java:137)   在   com.ibm.xsp.application.ViewHandlerEx.createView(ViewHandlerEx.java:93)   在com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:250)   在   com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157)   在com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:159)处   com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138)位于   com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)   在   com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:588)   在   com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1335)   在   com.ibm.designer.runtime.domino.adapter.ComponentModule $ AdapterInvoker.invokeServlet(ComponentModule.java:865)   在   com.ibm.designer.runtime.domino.adapter.ComponentModule $ ServletInvoker.doService(ComponentModule.java:808)   在   com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:577)   在   com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1319)   在   com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662)   在   com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)   在   com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357)   在   com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313)   在   com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)   原因:java.lang.Throwable:错误:找不到“ compositeData”   com.paulwithers.openLog.OpenLogErrorHolder.getInterpretException(OpenLogErrorHolder.java:113)   ...另外67个

2 个答案:

答案 0 :(得分:3)

如Sven所说,包含com.ibm.xsp.component的行是要检查的行,在这种情况下为com.ibm.xsp.component.xp.XspOutputLabel.getFor(XspOutputLabel.java:158) at。实际上,这应该为您提供足够的信息来解决问题。 XspOutputLabel表示它是一个标签组件-在local文件夹中的Package Explorer中查看已构建的Java类,您将看到为XPage创建了哪些Java类(选择一个简单的XPage!)。 get....位还告诉您触发错误的属性,在这种情况下,getFor表示它是for属性。该错误表明计算无法设置compositeData。因此,查找具有使用for的计算compositeData属性的Label。

通常,如果您得到的是模糊的“ _id ....”,则表示该组件未设置id属性,因此只需<xp:label value="My Label"></xp:label>而不是<xp:label id="myLabel" value="My Label"></xp:label>

答案 1 :(得分:3)

下次,您可以执行以下操作:

创建Java类“ JavaScriptDebugBindingFactory”

package ch.hasselba.xpages;

import com.ibm.xsp.binding.BindingFactory;
import com.ibm.xsp.util.ValueBindingUtil;
import javax.faces.application.Application;
import javax.faces.el.MethodBinding;
import javax.faces.el.ValueBinding;

public class JavaScriptDebugBindingFactory implements BindingFactory {
    public static final String JAVASCRIPT = "javascript";

    public String getPrefix() {
        return "javascript";
    }

    public MethodBinding createMethodBinding(Application app, String str,
            Class[] arr) {
        String tmpStr = ValueBindingUtil.parseSimpleExpression(str);
        return new JavaScriptDebugMethodBinding(tmpStr, arr);
    }

    public ValueBinding createValueBinding(Application app, String str) {
        String tmpSttr = ValueBindingUtil.parseSimpleExpression(str);
        return new JavaScriptDebugValueBinding(tmpStr);
    }
}

添加MethodBinding类

package ch.hasselba.xpages;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.EvaluationException;
import javax.faces.el.MethodNotFoundException;

import com.ibm.xsp.binding.javascript.JavaScriptMethodBinding;
import com.ibm.xsp.exception.EvaluationExceptionEx;

public class JavaScriptDebugMethodBinding extends JavaScriptMethodBinding {

    public JavaScriptDebugMethodBinding() {
        super(null, null);
    }

    public JavaScriptDebugMethodBinding(String str,
            Class[] arr) {
        super(str, arr);
    }

    public Object invoke(FacesContext fc, Object[] obj)
            throws EvaluationException, MethodNotFoundException {
        UIComponent cmp = getComponent();
        try {
            return super.invoke(fc, obj);
        } catch (EvaluationExceptionEx e) {
            System.out.println("COMPONENT: " + cmp.getId());
            throw e;
        }
    }
}

添加类JavaScriptDebugValueBinding

package ch.hasselba.xpages;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.EvaluationException;
import javax.faces.el.PropertyNotFoundException;

import com.ibm.xsp.binding.javascript.JavaScriptValueBinding;
import com.ibm.xsp.exception.EvaluationExceptionEx;

public class JavaScriptDebugValueBinding extends JavaScriptValueBinding {

    public JavaScriptDebugValueBinding() {
        super();
    }

    public JavaScriptDebugValueBinding(String str) {
        super(str);
    }

    public Object getValue(FacesContext fc) throws EvaluationException,
            PropertyNotFoundException {
        UIComponent cmp = getComponent();
        try {
            return super.getValue(fc);
        } catch (EvaluationExceptionEx e) {
            System.out.println("COMPONENT: " + cmp.getId());
            throw e;

        }
    }
}

覆盖beforePageLoad中的JavaScript处理程序

<xp:this.beforePageLoad>
    <![CDATA[#{javascript:
        importPackage( ch.hasselba.xpages );
        var facts = facesContext.getApplication().getFactoryLookup();
        facts.setFactory("javascript", new ch.hasselba.xpages.JavaScriptDebugBindingFactory())

    }]]>
</xp:this.beforePageLoad>

发生错误时,组件的ID将打印到服务器控制台。