关于运行xforms-with-java-applications的Orbeon文档, 我在JBoss的java war之后单独部署了Orbeon的war文件。
我尝试在一个模型中创建2个实例
<xforms:model id="fr-form-model">
<xforms:instance id="don-instance1">
<don>
<laptop>
</laptop>
</don>
</xforms:instance>
<xforms:instance id="don-instance2">
<don2>
<laptop2>
</laptop2>
</don2>
</xforms:instance>
</xforms:model id="fr-form-model">
我似乎无法从
访问第二个xforms实例<xforms:input ref="instance('don-instance')/don/laptop2">
<xforms:label>Enter a Name:</xforms:label>
</xforms:input>
只要我不使用instance()函数
,访问第一个xforms实例就可以了<xforms:input ref="/don/laptop">
<xforms:label>Enter a Name:</xforms:label>
</xforms:input>
不知何故,instance()方法无法正常工作,我缺少什么?
修订完整XML:
<xhtml:html
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
>
<xhtml:head>
<xhtml:title>Simple</xhtml:title>
<xforms:model >
<xforms:instance id="don-instance1">
<don1>
<laptop1>
</laptop1>
</don1>
</xforms:instance>
<xforms:instance id="don-instance2">
<don2>
<laptop2>
</laptop2>
</don2>
</xforms:instance>
<xforms:submission id="submit_metadata" action="../processor.jsp" method="post"/>
</xforms:model>
</xhtml:head>
<xhtml:body>
<xforms:input ref="instance('don-instance1')/don1/laptop1">
<xforms:label class="composers-label">Laptop1: </xforms:label>
<xhtml:br />
</xforms:input>
<xforms:input ref="instance('don-instance2')/don2/laptop2">
<xforms:label class="composers-label">Laptop2: </xforms:label>
<xhtml:br />
</xforms:input>
<xhtml:br />
<xhtml:br />
<xforms:submit submission="submit_metadata">
<xforms:label class="composers-label">Submit</xforms:label>
</xforms:submit>
<xhtml:br />
<fr:xforms-inspector/>
</xhtml:body>
</xhtml:html>
答案 0 :(得分:1)
根据代码,我发现您没有正确引用节点名称。如果您想在第一个实例中访问笔记本电脑节点,那么您的代码应如下所示:
<xforms:input ref="instance('don-instance1')/laptop">
<xforms:label>Enter a Name:</xforms:label>
</xforms:input>
同样,如果你想在第二个实例中访问节点,它应该是
<xforms:input ref="instance('don-instance2')/laptop2">
<xforms:label>Enter a Name:</xforms:label>
</xforms:input>