users@javaserverfaces.java.net

JSF 1.2_04: How do create a page that loads values from a database, the user edits the values and saves the values back to the database, then redisplay the same page with the new values?

From: Todd Patrick <Todd.Patrick_at_dtn.com>
Date: Thu, 5 Jul 2007 12:51:51 -0500

JSF 1.2_04 How do create a page that loads values from a database, the user edits the values and saves the values back to the database, then redisplay the same page with the new values? What I am using currently is a f:view beforePhase attribute. In my managed bean, public void beforePhase(PhaseEvent event) contains the logic to load the data into the page by setting the managed beans fields. Everything seems to work fine, expect the log output is: APPLY_REQUEST_VALUES 2 |#] PROCESS_VALIDATIONS 3 |#] Test Comment <-- database value |#] UPDATE_MODEL_VALUES 4 |#] Test Comment <-- database value |#] INVOKE_APPLICATION 5 |#] Test Comment Update <-- user's entered value |#] RENDER_RESPONSE 6 |#] Test Comment <-- database value again??? |#] What is happening is my beforePhase method is resetting my managed bean field back to the previous database value. I don't understand this. I thought my database column value would be updated in the INVOKE_APPLICATION phase and the RENDER_RESPONSE phase would display the new value? "Why in the heck is it so hard to develop a simple page that loads values from a database and redisplays the *updated* values in the same page after the user updates the values through an Action or ActionListener?" Thanks, --Todd ----------------------------------------- NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.