Calling action method first

Hi,

I have the following form:

<h:form id='f1'>

<h:dataTable id="data" var="theItem" value="#{tplsf.dataModel}">

<h:column>

<f:facet name="header">

<h:commandLink value="Assignment" id='a' action='#{tplsf.orderByAssignment}'/>

</f:facet>

<h:outputText value="#{theItem}" />

</h:column>

</h:dataTable>

<h:selectOneMenu id="ps" value='#{tplsf.pageSize}'>

<f:selectItems value="#{tplsf.pageSizeList}"/>

</h:selectOneMenu>

<h:inputHidden id='startRow' value='#{tplsf.startRow}'/>

<h:commandButton id='p' value='Previous' action='#{tplsf.previous}'/>

<h:commandButton id='n' value='Next' action='#{tplsf.next}'/>

</h:form>

What I need to do is when user clicks on "Next" button then next method is called before any get method specially (getDataModel). I must admit my understanding for jsf life cycle is poor. I am after a quick fix. Any help will be highly appreciated.

Regards

[1115 byte] By [jbaudha] at [2007-11-26 16:30:55]
# 1
Why do you want to achieve this?Anyway, this might give you some insights in the JSF lifecycle: http://balusc.xs4all.nl/srv/dev-jep-djl.html
BalusCa at 2007-7-8 22:55:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

I need to implement a simple data scroller.

User clicks on next i will update current page value in the backing bean and getDataModel will use current page value to get rows from database.

BTW, thanks for the link. I had a quick look at this page before I posted. As I said I am after a quick solution .. will get into the details if I cant find it here :-)

jbaudha at 2007-7-8 22:55:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Add a valueChangeListener to the selectOneMenu, this will be invoked in the 3rd phase of the JSF lifecycle, right before the 4th phase (update values) and even before the 5th phase (invoke application).
BalusCa at 2007-7-8 22:55:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
ok, sort of solved my problemThe problem was the getDataModel was being called in APPLY_REQUEST_VALUES phase and if this method does not return null then this method is not called again in Render Response Phase.Let me know if this does not make sense.
jbaudha at 2007-7-8 22:55:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Correction:getDataModel was called in both phasesI had a if bock outside my debug statement
jbaudha at 2007-7-8 22:55:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...