JSF DataTable Question

This will give me a text box that is initially set with the text value of 5:

<h:inputText value="5" required="false" />

If I put that in a dataTable, it is not prepopulated with the string "5". For the initial value to work, I must use:

<h:inputText value="#{5}" required="false" />

Two questions:

- Why does value="5" work outside of a dataTable and not inside?

- How would I get a text constant in the second example? value="fubar" works outside of a dataTable, but value="#{fubar}" looks for a variable named fubar.

I'm using:

JSF 1.1_01

Apache Tomcat 5.5.9

[736 byte] By [Gamigina] at [2007-10-2 9:48:43]
# 1
it would help if u post the JSP code associated with the dataTable
tinashechipomhoa at 2007-7-16 23:54:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

It was a really trivial example. Originally, I was using a complex project where a custom control just wasn't prepopulating in a dataTable. I started a brand new project and isolated it to the simple inputText case.

This isn't the exact code (which is at my office) but it's very close:

<h:dataTable value="#{managedBean.dataList}" var="row">

<h:column>

<f:facet name="header">

<h:outputText value="Title" />

</f:facet>

<h:inputText value="5" required="false" />

</h:column>

</h:dataTable>

Gamigina at 2007-7-16 23:54:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

I have noticed the same problem with JSF RI 1.2, although I also find that using the workaround here causes the form submit to fail:summary.xhtml @46,56 value="#{10}": Illegal Syntax for Set Operation

I can't see why this component should behave differently when used in a h:dataTable.

Suggestions anybody?

Roger_Keaysa at 2007-7-16 23:54:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...