On 9/14/06, Titi Wangsa <[EMAIL PROTECTED]> wrote:
hello,
i'm using myfaces 1.1.3 and shale 1.0.3 and tomahawak 1.1.3

i have a page, list.jsp
containing a list of items
the list is initialized by a shale backed backed bean that
execute's its init() method prior to loading the page
the init method checks to see if its a postback request
if its not then it requeries the database

my question is
if i click on a link and display the details of an item on the list
and i click a link to "back to list"
the database query runs again, because its not a postback request

A couple of avenues to look at:

What kind of component are you using for the "back to list" control?  If it is something like an <h:outputLink>, then the behavior you are seeing is expected ... this control does a GET request on the new URL, where an <h:commandLink> or <h:commandButton> would cause a postback.

If you are already using <h:commandButton> or <h:commandLink>, are you trying to check the postback state on the *initial* page being invoked, or on the page you are navigating to?  The postback flag is only going to be set on the initial page, not the page you are navigating to.  Perhaps you can cache the details of the item in session scope and bind to it there?  And clear the cache whenever the data that might have been cached is no longer valid?

Craig

my question is
how do i solve this, making the "back to list" function work without
hitting the db

i know that i have to put a flag to tell the shale ViewController class to
query/not-to-query the database.

Or is my current method of obtaining the list is not-exactly-right?

please advice. thank you.

Reply via email to