Web development is divided into two parts: front-end and back-end. The code at both ends has various interaction needs and modes. The front-end Javascript performs the checksum interface operation, and the business logic runs on the server. In the early interaction mode, the front-end scripts are submitted after verification. After the server runs the business logic, it switches to another page or changes the display of the original page. After Ajax is popular, the front-end Javascript is submitted without refreshing the page, and then the page is updated after waiting for the server results. The page update can be divided into two situations. One is that a common server returns a small number of running results, and Javascript modifies HTML based on these results in the browser; the other method is XPages. It is based on JSF and contains the HTML generation stage in the lifecycle of a page. The displayed changes are completed on the server rather than on the browser, javascript is only responsible for replacing the HTML of a node with a specified id. In a Web application, the page does not change and the display is not much different when it is saved or submitted successfully. Sometimes you need to remind the user of the result of the previous operation. At this time, you can simply use the alert () function pop-up window on the returned page (earlier practices ), you can also show messages in special backgrounds and fonts in a certain part of the page more gently (currently popular ). These two methods are easily implemented in XPages. Solution 1: Execute the business logic first when you click an event on a button, and then a prompt is displayed on the returned page. [Html] <xp: button value = "Label" id = "button1"> <xp: eventHandler event = "onclick" submit = "true" refreshMode = "complete"> <xp: this. action> <! [CDATA [# {javascript: // Business logic goes here. view. postScript ("alert ('done')");}]> </xp: this. action> </xp: eventHandler> </xp: button> postScript is an interesting and useful method created by XPages for the view object, it will pass the script in the parameter to the front-end for execution. Solution 2: Add a text on the page to display the operation result (the style is bold, black, and yellow background color), and bind the value to requestScope. message. After the business logic is executed in the button, the status is passed into requestScope. message. [Html] <xp: div style = "text-align: center"> <xp: text escape = "true" id = "message" contentType = "html" value = "# {requestScope. message} "style =" background-color: rgb (255,255, 0); font-weight: bold "> </xp: text> </xp: div> <xp: button value = "Label" id = "button1"> <xp: eventHandler event = "onclick" submit = "true" refreshMode = "complete"> <xp: this. action> <! [CDATA [# {javascript: // Business logic goes here. requestScope. put ("message", "done") ;}]> </xp: this. action> </xp: eventHandler> </xp: button> If the business logic is written in Java in Bean, the preceding two solutions can be easily implemented: [java] UIViewRootEx2 view = (UIViewRootEx2) FacesContext. getCurrentInstance (). getViewRoot (); view. postScript ("alert ('done')"); FacesContext. getCurrentInstance (). getExternalContext (). getRequestMap (). put ("message", "done"); you can see that the view in the server-side Javascript above is a Java UIViewRootEx2 object, which is an extension of XPages to the jsf ViewRoot interface, still obtained from the getViewRoot method of the FacesContext instance