i have stupid question but im so curious that i must ask...
what does preserveDataModel attrib mean?
tag library says that:
"Indicates whether the state of the whole DataModel should be saved and
restored. Default: false"
but what doest it mean?
what happends when model is saved (true) and what happends when isnt?
in my projects i tried to change it but i havent noticed any differences
(maybe i just dont know what to look for;)
cheers
Slawek
That should work with MyFaces out of the box - the only thing you
might need to do would be to set the preserveDataModel to true - value
change listeners should not be necessary.
regards,
Martin
On 7/5/05, Bruno Aranda <[EMAIL PROTECTED]> wrote:
Hi Jason, I have a solution for you using myfaces. There will be more
elegant solutions, but this one should work for you:
I take for granted that you have your variable-length array in a
backing bean (call 'arrayValues' for instance), with public accessor
methods. The code for the jsp page could look like The jsp code could
look like
[CODE]
<h:form>
<x:dataTable var="val" value="#{yourBackingBean.arrayValues}"
rowIndexVar="indexVar">
<h:column>
<h:inputText value="#{val}"
valueChangeListener="#{yourBackingBean.updateValue}">
<f:param name="index" value="#{indexVar}"/>
</h:inputText>
</h:column>
</x:dataTable>
<h:commandButton value="Process array"
action="#{yourBackingBean.processArray}"/>
</h:form>
[/CODE]
Every inputText has its valueChangeListener and a parameter. The
valueChangeListener should point to a method in your bean that
retrieves the new value and the index of the changed component, in
order to update the corresponding values of the array, something like
this:
[CODE]
public void updateValue(ValueChangeEvent vce) {
// get the new value of the inputText
String newValue = (String) vce.getNewValue();
// get the child parameter of the inputText (I know it is the
only child), to get the index value
UIParameter param = (UIParameter)
vce.getComponent().getChildren().get(0);
Integer index = (Integer) param.getValue();
// update the value in the array
arrayValues[index.intValue()] = newValue;
}
[/CODE]
Then you will have, a column of inputText and one h:commandButton (in
the example calls to a method in your backing bean called
processArray):
Hope this helps,
Regards,
Bruno
2005/7/5, Jason Nichols <[EMAIL PROTECTED]>:
>
>
>
> Another way of asking is can you put h:outputText inside h:dataTable
without
> a commandButton/Link on each line.
>
>
>
> Btw although I'm fairly new to jsf I'm not looking for someone to do
my work
> for me, I've been struggling for a week when I realized I've never
seen
> anything like this on ANY web page, so if it's
>
> just not possible I'd like to learn why.
>
> Regards,
>
> Jason