Note that there are some explanatory texts on larger screens.

plurals
  1. POAccessing java-based DOM tree directly from JSF/richfaces
    primarykey
    data
    text
    <p>Based on <a href="https://stackoverflow.com/questions/2141464/how-to-access-complex-java-maps-in-jsf-richfaces">this question</a> I have a couple of other questions:</p> <p>1) the map in this question which is made available to jsf is actually one of a number, so i'm now not sure what the backing bean method's return type should now be. if i modify it's current <code>Array&lt;String&gt;</code> return type to <code>Array&lt;Map Integer, Map&lt;String, String[]&gt;&gt;&gt;</code> (or <code>ArrayList&lt;Map Integer, Map&lt;String, String[]&gt;&gt;&gt;</code> ?) would it just be a case of further nesting the iterator on the jsf side? Trouble is an Array/ArrayList isn't a Map and I'm unsure how this then looks in jsf. would this be correct: </p> <pre><code>&lt;c:forEach items="#{bean.map}" var="entry"&gt; &lt;!-- array --&gt; &lt;c:forEach items="#{entry.value}" var="nentry"&gt; &lt;!-- map --&gt; &lt;h:outputText value="Key: #{nentry.key}, Values:" /&gt; &lt;!-- integer --&gt; &lt;c:forEach items="#{nentry.value}" var="nnentry"&gt; &lt;!-- sub map --&gt; &lt;h:outputText value="Key: #{nnentry.key}, Values:" /&gt; &lt;!-- string --&gt; &lt;c:forEach items="#{nnentry.value}" var="nnnentry"&gt; &lt;!-- string[] --&gt; &lt;h:outputText value="#{nnnentry}" /&gt; &lt;/c:forEach&gt;&lt;br /&gt; &lt;/c:forEach&gt;&lt;br /&gt; &lt;/c:forEach&gt;&lt;br /&gt; &lt;/c:forEach&gt; </code></pre> <p>?</p> <p>2) what i'm really storing in this map is xpath rips from an XML DOM tree parsed on the java side. i'm now thinking i can access this java-based DOM tree from JSF directly without having to use XPath -> ArrayOfMaps and return that. In an XML file which looks something like this, is there a better way than using the above method?:</p> <pre><code> &lt;test&gt; &lt;testid&gt;1&lt;/testid&gt; &lt;testname&gt;myName&lt;/testname&gt; &lt;inst&gt; &lt;id&gt;1&lt;/id&gt; &lt;src&gt;C:\my\path&lt;/src&gt; &lt;mask&gt;.*\.\w{3}&lt;/mask&gt; &lt;mask&gt;.*\.x&lt;/mask&gt; &lt;/inst&gt; &lt;inst&gt; &lt;id&gt;2&lt;/id&gt; &lt;src&gt;C:\my\otherpath&lt;/src&gt; &lt;mask&gt;.*\.\w{3}&lt;/mask&gt; &lt;mask&gt;.*\.x&lt;/mask&gt; &lt;/inst&gt; &lt;/test&gt; </code></pre> <p>Thanks again Mark</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload