Use of DWR in Java

Source: Internet
Author: User

 

Last time I shared a message about the lower-right corner of the frameset framework.

Connection here http://www.cnblogs.com/zhangnanblog/archive/2012/06/20/jqueryMessage.html

In this case, no message is obtained from the message table of the database during project development. Instead of writing it to death. So what should we do in Java?

Finally, I chose DWR to get and display the message.

The following is an example:

Http://files.cnblogs.com/zhangnanblog/Msg.rar

Paste DWR. xmlCode:

 <?  XML version = "1.0" encoding = "UTF-8"  ?>  <!  Doctype DWR public "-// getahead limited // DTD direct Web remoting 3.0 //" http://getahead.org/dwr/dwr30.dtd" >  <  DWR  >      <  Allow  >          <  Create  Creator  = "New"  Javascript  = "Msgdeal"  >              <  Param  Name = "Class"  Value  = "Com. msg. msgdeal"  />          </  Create  >      </  Allow  >  </  DWR  > 

As for DWR, I used it for the first time ~~ So I just shared my usage problems.

In the preceding DWR. XML, we configured the service to be called.

The following shows how to reference in JSP:

 Function Test1 (){  VaR _ DATA = "" ; DWR. Engine. setasync (  False ); //  Set Synchronization Msgdeal. getmsg (1, Function (Data) {_ DATA = data ;}); //  Call the Message Processing Method of the msgdeal class in Java DWR. Engine. setasync ( True ); //  Set to initial status Document. getelementbyid ("serverresponse"). value = _ data;//  Set the obtained value       If (_ DATA> 0 ){ //  There are new messages           //  Is the message chart flashing } Else  {  //  No new message  }} 

So what does msgdeal. getmsg (1,Function(Data) {_ DATA = data ;});//Call the Message Processing Method of the msgdeal class in Java
Msgdeal here is what we configured in DWR. xml<CreateCreator= "New"Javascript= "Msgdeal">

As for the detailed usage, you can see the sample downloaded.

In the lower-right corner of the frameset framework, a message + DWR is displayed to obtain the message. I realized the function of message prompting. Maybe my method is not very good. There are also many problems.

I hope you can give me some guidance on this cainiao!

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.