Example of combining DWR with spring
Applicationcontext. xml file
Java class
Package com. zscqj. Common;
Public class Hello {
Public String say (string INFOR ){Return "the message you sent is:" + infor;}}
JSP page:
String Path = request. getcontextpath ();String basepath = request. getscheme () + ": //" + request. getservername () + ":" + request. getserverport () + path + "/";%>
Haha, no address! The basepath on this page is
What is DWR?
DWR is a Java project of open source. DWR allows JavaScript to call Java programs running on the Web server. Simple or professional is easy Ajax for Java. Official Website: http://getahead.org/dwr, the following will be a step-by-step introduction how to complete a simple demo:Testdwr.
1. Download The
Introduction to dwr
In addition to a commons-logging-1.2.jar,
Put dwr. jar and commons-logging-1.2.jar in lib.
Let's take a look at an entry-level teaching material at www.bkjia.com.
This write is very simple and can be implemented according to the configuration.
1. entity User
Package iwco. entity; public class User {// Login ID, the only private String id of the primary key; // name private String name;
In fact, DWR did not generate any "files" at all. We create a DWR project, want to see it automatically generated JS files, no matter what method you search (such as Google's Desktop search engine), will not find the so-called "dwr/interface/xxx.js" or "Dwr/engine.js", "dwr/
See some examples on the internet, for a simple three-level linkage, plus what struts, hibernate, and so on. This Ajax linkage does not know what the relationship with these frameworks, a small demo why the whole so big.
Today, I did an example of dwr+jsp.
Xml:
Copy Code code as follows:
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
Xsi:sc
In fact, DWR did not generate any "files" at all. We create a DWR project, want to see it automatically generated JS files, no matter what method you search (such as Google's Desktop search engine), will not find the so-called "dwr/interface/xxx.js" or "Dwr/engine.js", "dwr/
In various forums for a long time, did not see the complete ExtJS Tree generation code. Finally, the Spring+hibernate+dwr+extjs tree and the Drop-down comboboxtree were realized.
One, the object model of the tree.
Java Code packagecom.ssgly.model; importjava.util.list; importjava.util.set; publicclassregion{ nbsp;privatelongid; privateStringname; p
2. Call a Java method with a simple return value
2.1. configuration of DWR. xml
Configuration is the same as 1.1
2.2 calls in Javascript
First, introduce JavaScript scripts
Second, write the JavaScript function that calls the Java method and the callback function that receives the returned value.
Function calltestmethod2 (){
Testclass. testmethod2 (callbackfortestmethod2 );
}
Function callbackfortestmethod2 (data ){
// The Return Value of the date rec
[Preface]
Read rich life and good code to share. I am aliman, and I look forward to communicating with you.
The following content is for the purpose of learning. The cover content is wide but not deep, and there may be some problems. Empty box.
[Hardware environment]
Ordinary PC, 4 GB memory, GB hard drive
[Operating system]
The following systems are virtual machines running on the same machine
Centos5.5-9 SVN server, release script
Centos5.5-4 jbo
Recently, an application using spring 1 MVC + hibernate 3 + dwr1 found a strange problem. Where dwr1 is used
When registering a user, determine whether the user exists. The Code is as follows:
DWR Configuration
But when running it, I always said that DWR could not find the userfacade method. I checked all the links again. That's all right. It's the same as the
Bkjia.com documentThis tutorial uses DWR (a Java Implementation of AJAX) as the page!
1. The following is the configuration of DWR.
(1) Configure DWRServlet in web. xml as follows:
Reference content is as follows:
(2) Configure in dwr. xml
Reference content is as follows:
2. Compile PageBean to store the data to be d
DWR:
Direct Web remoting is an open-source Remote Server Ajax framework used to improve the interaction between web pages and Java. It can help developers develop websites that contain Ajax technology. It allows the code in the browser to use Java functions running on the Web server, just as it is in the browser.
Demo:
Pom. xml:
Web. xml:
DWR
Believe that many projects, often file upload function bar.
Can I upload a file with Dwr? Simplifies the file upload process.
The answer, of course, is "certainly achievable".
The file upload function with DWR requires more than 3.0 versions.
OK, let's take a look at some basic things about file uploads.
1.html:
2.js
var files = dwr.util.getValue ("file");//This is the method in the Util.j
The original: "Zongheng Technology" based on the DWR framework of the REVERSEAJAX message push has a diagram!Source code: Http://www.zuidaima.com/share/1584228052847616.htm\The initial design of the network is not to allow the server to initiate a connection to the browser, so getting data from the browser in a timely manner is a tricky issue.Reverse Ajax is the ability to send data asynchronously from a We
DWR Session Error
Yesterday in the use of DWR encountered a session error error, Google, after a foreigner in a forum to see a solution,is to configure the following in the Web.xml:Org.directwebremoting.servlet.DwrServletThe one in the middle.Therefore, ask. Posted on 2007-05-24 19:02 Zhang Brothers Reading (1015) Comments (3) Edit Collection--> Comments:#re:dwr Session error 2007-06-25 15:51 | LisaThank yo
Directly obtain the return value of a Java class in DWR.DWR is an open-source framework of Ajax and can easily call remote Java classes. However, DWR can only use the callback function to obtain and process the returned value in the callback function. So, is there a way to directly obtain a method's return value? Below I will write a simple Java class, as follows: public class test () {Public String getstring () {return "test" ;}} the above class is v
2005 is the most popular year of Ajax, And the Ajax applications that use Gmail as a pioneer have gradually become deeply rooted in the hearts of the people. Maybe this is the so-called reincarnation. The design of the computer interface is from first thin to then fat to thin, and now it is again fat. However, there are many differences between the fat web interface and the fat web interface. The fat web interface mainly depends on dhml and JavaScript. This is the reason for this article. I beli
This is a web project
The first is the Web. xml file.
Then the DWR configuration file DWR. xml
The index. jsp page is used to test and display the DWR effect.
The following are the two JavaBean classes used.
Package COM. jadyer. model;
This is a common Java class to be released by DWR.
Package COM. jadyer.
Atitit. Best practices for form editing dwr jq easyui
1. Submit Form 1
2. Form Verification 1
3. Use meger to save and update data.
3.1. filter: :( MP> do) 1
3.2. 2. Convert (MP> do) 2
3.3. valider 2
3.4. Default Value Setting problems... (do only) 2
4. Form echo (edit mode) 2
1. submit the form
Jq d serize
Easyuui yanen l...
Dwr3 Korean is the simplest...
Function save ()
{
VaR OBJ = DWR. util. getvalue
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.