Recently, ESET add my domain name to the black-list of their database. You can’t open my site and been warned my site is not safe if your PC is running the ESS or EAV. Why Eset block my site?The answer is obvious. That is reason that you come here. I promise that my site is pure, no virus, no spyware, no Trojan, no pop ads. You can test my word through intalling Kaspersky or other Antivirus Software. If you want open my site and take latest escalation ID & Activation Code, close your ESET software(disable antivirus and antispyware protection function temporarily) or by proxy or virtual machinor. You can also feed the RSS source http://feed.loserblog.cn.
Home > Programm > DWR primary study

DWR primary study

DWR is a can allow you to create AJAX WEB site JAVA open-source library. It can let you in the browser's Javascript code on the Web server called the Java code, like Java code in a browser on the same.
HelloWorld example:
1.web.xml
<servlet>
<servlet-name> dwr-invoker </ servlet-name>
<servlet-class> org.directwebremoting.servlet.DwrServlet </ servlet-class>
<init-param>
<param-name> debug </ param-name>
<param-value> true </ param-value>
</ init-param>
<init-param>
<param-name> crossDomainSessionSecurity </ param-name>
<param-value> false </ param-value>
</ init-param>
</ servlet>
<servlet-mapping>
<servlet-name> dwr-invoker </ servlet-name>
<url-pattern> / dwr / * </ url-pattern>
</ servlet-mapping>


2.dwr.xml
<dwr>
<allow>
<create creator="new" javascript="helloWorld">
<param name="class" value= "com.HelloWorld" />
</ create>
</ allow>
</ dwr>

3. HelloWorld class preparation
package com;

public class HelloWorld (
public String sayHello (String yourName) (
return "Hello World" + yourName;
)
)

4. Preparation of a jsp
<html>
<head>
<script type="text/javascript" src='js/util.js'> </ script>
<script type="text/javascript" src='js/engine.js'> </ script>
<script type="text/javascript" src='dwr/interface/helloWorld.js'> </ script>

<script type="text/javascript">
function firstDwr () (
helloWorld.sayHello ( "ucatch", callBackHello);
)
function callBackHello (data) (
return alert (data);
)
</ script>
</ head>
<body>
<input type="button" name="button" value="测试" onclick="firstDwr()">
</ body>
</ html>

Categories: Programm Tags:
  1. No comments yet.
  1. No trackbacks yet.
  • Partner links