0

When i use index with outputText, anything is OK.

<ui:repeat id="topTenGrd" var="dream" value="#{dreamModifyBean.topDreams}" varStatus="status">
    <h:outputText class="dream-title uppercase" value="#{status.index}" />
</ui:repeat>

But i change outputText -> inputText then when click any button on screen , the error PropertyNoWritableException occured.

<ui:repeat id="topTenGrd" var="dream" value="#{dreamModifyBean.topDreams}" varStatus="status">
    <h:inputText class="dream-title uppercase" value="#{status.index}" />
</ui:repeat>

Any idea why?

Han Kun
  • 73
  • 12
  • Are you using Richfaces? – Venkat Raj Aug 28 '17 at 09:39
  • 1
    Refere this link https://stackoverflow.com/questions/40575421/propertynotwritableexception-illegal-syntax-for-set-operation-error-when-sett – Venkat Raj Aug 28 '17 at 09:42
  • @venkatraj : tks for comment. I don't use Rickfaces. – Han Kun Aug 28 '17 at 09:45
  • Okay, then refer the above link, it will help you to resolve your issue. If you use h:inputText, then must need getter and setter. in your program you did't use encapsulation. you directly getting values for h:inputText from the ui:repeat varStatus. – Venkat Raj Aug 28 '17 at 09:48
  • You cannot SET the varStatus index property... That is just not how it should be used – Kukeltje Aug 28 '17 at 10:43

1 Answers1

0

Try this.

JAVA:

String indexs[] = new String[10]; // Need encaptulation

UI:

<ui:repeat id="topTenGrd" var="dream" value="#{dreamModifyBean.indexs}" varStatus="status">
    <h:inputText class="dream-title uppercase" value="#{dream}" />
</ui:repeat>
Venkat Raj
  • 219
  • 3
  • 18
  • I _think_ that will throw an error of some kind as well... `value="{dreamModifyBean.indexs[status.index]}"` is what should be used in case of Strings. See the duplicate Q/A – Kukeltje Aug 28 '17 at 10:46