javaxjcr节点getProperties和Titles

javaxjcr节点getProperties和Titles,java,swing,jsp,nodes,jcr,Java,Swing,Jsp,Nodes,Jcr,我得到一个节点,然后我从另一个节点请求它 Node nn = node.getNode("jcr:content"); 从这里,我可以执行以下操作来获得 nn.getProperty("cq:lastModified") 我要做的是获取所有属性,而不要求每个属性的名称 Node nn = node.getNode("jcr:content"); PropertyIterator pi = nn.getProperties(); 现在我可以迭代属性并打印它们的值,如下所示: while(pi

我得到一个节点,然后我从另一个节点请求它

Node nn = node.getNode("jcr:content");
从这里,我可以执行以下操作来获得

nn.getProperty("cq:lastModified")
我要做的是获取所有属性,而不要求每个属性的名称

Node nn = node.getNode("jcr:content");
PropertyIterator pi = nn.getProperties();
现在我可以迭代属性并打印它们的值,如下所示:

while(pi.hasNext())
{
   Property p = pi.nextProperty();
   String val = p.getString();
}

但是我怎样才能找到这个属性的标题呢?

我不确定,但是您可以尝试
getName()
方法,因为
Property
接口是
接口的子接口。您可以尝试以下方法:

while(pi.hasNext())
{
   Property p = pi.nextProperty();
   String name = p.getName();
   String val = p.getString();
}