This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi folks, i am having a design issue with my web application. I am using the struts framework for the application. the problem i am having is as follows. I have a page1.jsp in which the user can enter info. in a form. when he clicks on submit, the information is uploaded into the database and the user is taken to page2.jsp where he can view a readonly format of the information that he just entered. Now if he presses refresh, the data is re-entered into the database. I know what the problem is (sort of) but i am looking for the correct way to handle this kind of situation. the following is a psuedo flow of what is going on. page1.jsp --> createRec.do -->(mapped in struts-config.xml to) --> createRecordAction --> RecordBizObj (does the validation and calls the data access object to create record) --> comes back successfully to createRecordAction --> forwarded to page2.jsp . pressing refresh recalls the createRec.do and the whole enchillada starts again. how can or should i tackle this problem. Please help. eagerly awaiting your response. Thank you.
Hi there, when you clicks the refresh button in jsp 2, what do you want to achieve? since you said that all fields are read only(user wont be able to chnage the data), I assume that there will be no data to be updated. am I right?. well. If you still want to "re-enter" the data to the database(updating the available record, since you have already had the record when you click submit in jsp1), you could specify other method in the same action (as used by jsp 1) , by adding a specific flag. In the execute method of your action class, you can detect the existence of the flag, and delegate the request to specific method.