I am developing a web page in JSP/JSF. It has some text fields and check boxes. Page has Save button and few links to other pages. On clock of save button, information is saved in database. when user clicks on one this links, control is redirected to respective page.
When user clicks on links to other pages I would like to check, whether User has changed any test box, Drop down list, check box or not. If user has changed any field I would like to p开发者_StackOverflowrompt a message to user that He has changed information and it is not saved.
Could you please help me how to implement this.
Thanks
Use (#JSFManagedBeanName.MethodName) in onClick of the Sava Button & from that method, you can access the data of the whole JSF page.
In case of JSF 2.0, use JSF Validation. For, refernce.
<h:commandLink id="next" action="#{BeanName.MethodName}">
<h:outputText value="Next Page" />
</h:commandLink>
Put your validations in MethodName Method.
精彩评论