The latest release of MyFaces is 1.1.3 . There is an HTTP parameter called jsf_sequence that can be used to figure this out. You of course would want to put this behind a layer of abstraction in order to make a possible future transition to a different vendor less painful. I seem to remember this being a requirement for JSF 1.2, which the MyFaces team will be sinking their teeth into very soon.
Dennis Byrne >-----Original Message----- >From: iSquareOne LLC [mailto:[EMAIL PROTECTED] >Sent: Sunday, April 23, 2006 09:16 PM >To: [email protected] >Subject: How to tell if the request is the first time or the consequential >call to the same page? > > Hi, all, > I am new to this list. If my question is something that people have > asked, my apologies. We have been actively using MyFaces in our development > for 3 months and so far everything is fine. There are some glitches, but we > got around them. However I dont know the answer for this one. Hope you all > can share your opinions. Thanks in advance! > > The functional requirement is: > On a page, say Department page, there are save, search, next, prev > links. If the user opens this page for the first time (ie. without any > actions), load the page with all records; otherwise, perform the action that > user clicks (if the user clicks the search, the program should return the > matching records etc.) > > This page was backed by a session scope page bean. But now, we changed > it to the request scope. Then here is the problem: when the bean was a > session scope bean, I put the default search call in the constructor, so that > when the page is loaded, the default search is performed when the bean is > initialized. But now, the bean is request scope, every time it will be > constructed, so the default search call is called every time. However, if I > move the default search call outside the constructor, when the page is > loaded for the first time, it wont be called, so the page is not loaded > with records. > > So, my question is is there a way to tell if the request is the first > time or the consequential call to the same page? > > Code Snippet: > In the bean: > public DepartmentBean() > { > super(); > // Initializes the delegate > delegate = (DepartmentDelegate) DelegateFactory > > .getDelegate(DepartmentDelegate.class); > > delegate.findAll(); > > } > > To maintain the data from Department page to the next call to the > Department page, we use t:saveState: > <f:view> > <t:saveState id="_state" value="#{departmentBean._state}" /> > > > So in DepartmentBean, there are also getter/setter to populate the > current page state again. > > public void set_state(PageGridScalarEditableBeanState > _state) > { > searchParams = _state.getSearchParams(); > searchMode = _state.isSearchMode(); > editMode = _state.isEditMode(); > gridBackwardable = _state.isGridBackwardable(); > gridForwardable = _state.isGridForwardable(); > } > > public PageState get_state() > { > _state.setSearchParams(searchParams); > _state.setSearchMode(searchMode); > _state.setEditMode(editMode); > _state.setGridBackwardable(gridBackwardable); > _state.setGridForwardable(gridForwardable); > return _state; > } > > Notice one thing: the _state is not populated during the construction > time, so I cant use these variables in set_state() to determine if the > request is the first call. > > Again thanks! > > - Shawn > > >--------------------------------- >Celebrate Earth Day everyday! Discover 10 things you can do to help slow >climate change. Yahoo! Earth Day

