DWZ: page adds info pop-level info

Source: Internet
Author: User

Preface: DWZ default provides information level output of error, success, timeout, that is, when you submit information to the server, the foreground page can provide a popup theme for the above three, but sometimes we need to prompt the user a message, neither error, Is not success, we need info, tell the user just, then we need to make some modifications.
First, add the following code to the Baseconroller.java
Protected Modelandview ajaxdoneinfo (String message) {  return Ajaxdone (201, message, "");}

Next, call the location where you want to output info
return Ajaxdoneinfo (msg);

then, the front desk of the dwz.core.js need to change the content
PageInfo: {pagenum: "Pagenum", Numperpage: "Numperpage", OrderField: "OrderField", Orderdirection: "Orderdirection"}, StatusCode: {ok:200, error:300, timeout:301, info:201}, keys: {statusCode: ' StatusCode ', message: ' Message '},

Ajaxdone:function (JSON) {  if (json[dwz.keys.statuscode] = = DWZ.statusCode.error) {   if (json[dwz.keys.message ] && alertmsg) alertmsg.error (Json[dwz.keys.message]);  } else if (json[dwz.keys.statuscode] = = DWZ.statusCode.timeout) {   if (alertmsg) Alertmsg.error (json[ DWZ.keys.message] | | Dwz.msg ("Sessiontimout"), {okCall:DWZ.loadLogin});   else Dwz.loadlogin ();  } else if (json[dwz.keys.statuscode] = = DWZ.statusCode.ok) {   if (Json[dwz.keys.message] && alertmsg) Alertmsg.correct (Json[dwz.keys.message]);  } else if (json[dwz.keys.statuscode] = = DWZ.statusCode.info) {   if (Json[dwz.keys.message] && alertmsg) Alertmsg.info (Json[dwz.keys.message]);  }; },

Finally, change the following in the Dwz.ajax.js file
* {"StatusCode": "301", "message": "Session Timeout"} * {"StatusCode": "201", "message": "INFO Hint"} * */function Navtabajaxdone (JSON) { Dwz.ajaxdone (JSON); if (json[dwz.keys.statuscode] = = DWZ.statusCode.ok | | json[dwz.keys.statuscode] = = DWZ.statusCode.info) {  if ( Json.navtabid) {//mark the specified Navtab page as requiring "reload". Note that Navtabid cannot be the current Navtab page

function Dialogajaxdone (JSON) {dwz.ajaxdone (JSON); if (json[dwz.keys.statuscode] = = DWZ.statusCode.ok | | json[ DWZ.keys.statusCode] = = DWZ.statusCode.info) {

Add the following to the one more thing,index.jsp file
StatusCode: {    ok:200,    error:300,    timeout:301,    info:201   },//"optional"

Summary: Finally, remember to refresh the page cache, otherwise, you may not see the effect you changed, OK, see.

DWZ: page adds info pop-level info

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.