0

Managed bean method

public ObservableList<JurnalEntry> getJurnalEntries() {
    try {
        ObservableList<JurnalEntry> List = JurnalEntriesGateWay.GetJurnalEntries();
        return List;
    } catch (SQLException | ParseException ex) {
        return null;
    }
}

and jurnalEntry class

public class JurnalEntry {

     public int ID;
     public String Comment;
     public LocalDateTime DateAndTime;
     public SectionData SectionData;
     public ArrayList<EntryData> Entries;

     public JurnalEntry(int ID, String Comment, LocalDateTime DateAndTime, SectionData sectionData, ArrayList<EntryData> Entries) {
         this.ID = ID;
         this.Comment = Comment;
         this.DateAndTime = DateAndTime;
         this.SectionData = sectionData;
         this.Entries = Entries;
     }

     public String getComment() {
         return Comment;
     }

     public String getDate() {
         return JDateTime.toStringDate(DateAndTime);
     }

     public String getTime() {
         return JDateTime.toStringTime(DateAndTime);
     }

     public ArrayList<EntryData> getEntries() {
         return Entries;
     }

 }

which contain ArrayList<EntryData> Entries;

and entryData class

  public class EntryData {

     public int ID;
     public int SubAccountID;
     public int MainAccountID;
     public BigDecimal Value;
     public String Description;

     public EntryData(int ID, int SubAccountID, int MainAccountID, BigDecimal Value, String Description) {
         this.ID = ID;
         this.SubAccountID = SubAccountID;
         this.MainAccountID = MainAccountID;
         this.Value = Value;
         this.Description = Description;
     }

     public String getSubAccountName() throws SQLException {
         return DTables.ACCOUNTS.GetAccountName(SubAccountID);
     }

     public String getMainAccountName() {
         return AccountsGateWay.GetMainAccount(MainAccountID).getAccountName();
     }

     public BigDecimal getValue() {
         return Value;
     }

     public String getStringValue() {
         return AccountModel.BalanceAsString(Value.doubleValue());
     }

     public enum ValueType {
         Debit, Credit, Zero
     }

     public ValueType getValueType() {
         switch (Value.compareTo(BigDecimal.ZERO)) {
             case 0:
                 return ValueType.Zero;
             case 1:
                 return ValueType.Debit;
             default:
                 return ValueType.Credit;
         }
     }
 }

My jsp code

<p:dataScroller value="#{jurnalEntries.jurnalEntries}" var="jurnalEntry"  chunkSize="10" mode="inline" scrollHeight="500">
                <f:facet name="loader">
                    <p:commandButton type="button" value="المزيد" icon="ui-icon-circle-triangle-s"/>
                </f:facet>
                <div class="ui-g">
                    <div class="ui-g-2 JurnalEntryDebitValue">
                        <ui:repeat value="#{jurnalEntry.entries}" var="sub">
                            <c:if test="#{sub.value gt 0}">
                                #{sub.value}
                            </c:if>
                        </ui:repeat>
                    </div>
                    <div class="ui-g-2 JurnalEntryCreditValue">
                        <ui:repeat value="#{jurnalEntry.entries}" var="sub">
                            <c:if test="#{sub.value lt 0}">
                                #{sub.value}
                            </c:if>
                        </ui:repeat>
                    </div>
                    <div class="ui-g-5">1</div>
                    <div class="ui-g-3">1</div>
                </div>
            </p:dataScroller>

the problem is value in <h:outputText value="#{ss.value}"></h:outputText> is unknown property according to netbeans and it actually don't produce the value and ss refer to entries arraylist instead of refer to one of its items

jemystack
  • 408
  • 7
  • 12
  • Nesting a `c:if` in a `ui:repeat` and in the if using the var or the repeat does not work. https://stackoverflow.com/questions/3342984/jstl-in-jsf2-facelets-makes-sense – Kukeltje Jul 05 '17 at 17:07
  • @Kukeltje thank you for this answer now i understand what is the problem – jemystack Jul 05 '17 at 17:11
  • Possible duplicate of [JSTL in JSF2 Facelets... makes sense?](https://stackoverflow.com/questions/3342984/jstl-in-jsf2-facelets-makes-sense) – Kukeltje Jul 05 '17 at 17:15

0 Answers0