2007年11月5日

<script src="js/dojo/dojo.js" type="text/javascript"
   djConfig="parseOnLoad: true"></script>
<script type="text/javascript">
var span;
var tr;
var td;

dojo.addOnLoad(initTable);
function initTable(){
 dojo.forEach(
  dojo.query(".ajaxspan"),
  function(spantag){
   dojo.connect(spantag, 'onmouseover',this,'bggreen');
   dojo.connect(spantag, 'onmouseout',this,'bgnormal');
   dojo.connect(spantag, 'onclick', this, 'textChange');
  }
 );
}

function textChange(event){
 span = event.target;
 td = span.parentNode;
 tr = td.parentNode;
 var node = dojo.doc.createElement("input");
 dojo.attr(node,"type","text");
 dojo.attr(node,"id",tr.id);
 dojo.attr(node,"name",span.id);
 dojo.attr(node,"value",span.innerHTML);
 dojo.connect(node,"onblur",this,"saveTextChange")
 td.innerHTML = "";
 td.appendChild(node);
 node.focus();    
}

function saveTextChange(event){
 var node = event.target;
 if(dojo.trim(node.value)!=dojo.trim(span.innerHTML)&&node.value!=""){
  dojo.byId("ajaxmsg").innerHTML = "正在更新..."
  dojo.xhrPost({
   url:"show/console/newsTypeAjax",
   load:function(data,ioArgs){
    if("200"==ioArgs.xhr.status){
     span.innerHTML = node.value;
     td.innerHTML = "";
     span.style.backgroundColor="";
     td.appendChild(span);
     clearNode() 
     dojo.byId("ajaxmsg").innerHTML = "";
    }
   },
   error:function(data,ioArgs){
    dojo.byId("ajaxmsg").innerHTML = "更新失败:"+data;
    td.innerHTML = "";
    span.style.backgroundColor="";
    td.appendChild(child);
    clearNode()
   },
   content: getTextParams(node)
  });
 }else{
  td.innerHTML = "";
  span.style.backgroundColor="";
  td.appendChild(span); 
  clearNode()   
 }   
}

function getTextParams(node){
 if("desc"==node.name){
  return {
   "id":node.id,"name":node.value,"tag":"desc"
  }
 }
 if("cont"==node.name){
  return {
   "id":node.id,"name":node.value,"tag":"cont"
  }
 }
}

function clearNode(){
 span = null;
 tr = null;
 td = null;
}

function bggreen(event){
   event.target.style.backgroundColor="#CCCCCC";
}
function bgnormal(event){
 event.target.style.backgroundColor="";
}

</script>


<table width="100%" height="58"  style="border: solid 1px #EEF8F9"cellpadding="0" cellspacing="0" id="listTable">
    
<c:forEach items="${msg}" var="newstype">    
  <tr id="${newstype.news_type_id}">
  
    <td width="30%" height="28" class="font_name">
 <span id="cont" class="ajaxspan">
 ${newstype.news_type_name} 
 </span> 
 </td>
    <td width="46%" class="font_name">
 <span id="desc" class="ajaxspan">
  ${newstype.news_type_description}
 </span> 
 </td>
  </tr>
 </c:forEach> 
 
  <tr>
    <td height="28" colspan="2" class="font_name">&nbsp;</td>
    <td class="font_name">&nbsp;</td>
  </tr>
</table>

posted @ 2008-08-19 16:01 路依 阅读(652) | 评论 (0)编辑 收藏
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <title>Inline Edit Box Test</title>
        <script type="text/javascript" src="js/dojo/dojo.js"
            djConfig=" parseOnLoad: true"></script>

        <script type="text/javascript">
            dojo.require("dijit.InlineEditBox");
        </script>
    </head>
<body>
    Dear <span dojoType="dijit.InlineEditBox" width="200px" autoSave="true" title="recipient name">John</span>
</body>
</html>



几行代码即可实现!
posted @ 2008-08-06 17:40 路依 阅读(658) | 评论 (0)编辑 收藏
 

1. 从 http://ws.apache.org/axis2/download/1_0/download.cgi  网站下载axis2-std-1.0-bin.zip(Standard Distribution),及 axis2.war (War Distribution)

2. 在eclipse中新建JAVA工程,如AxisService 新建一个包Stub,在包中建立一个java文件HWS,内容如下:

package Stub;

public class HWS {
 public String echo(String value) {  System.out.println(">>>>> Service HelloWorldService: " + value + "   "
    + new java.util.Date().toLocaleString());
  return value;
 }
}

3. 在工程下面新建一个文件夹 META-INF ,并在其中建一个services.xml 内容如下:

<service>
 <parameter name="ServiceClass" locked="false">
  Stub.HWS
 </parameter>
 <operation name="echo">
  <messageReceiver
   class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
 </operation>
</service>

4. 打包成 *.aar 方法:

选中 Stub整个包,并且选中 services.xml  文件,右键 Export 为  JAR 文件。命名为: HWS.aar    Finish 即可.

这个HWS.aar   存在于 eclipse 中的workspace 目录下了.

5. 接下来到Tomcat中去. 将下载好的 axis2.war 解压到 Tomcat5.5的webapps中, 启动 Tomcat5.5

键入  http://127.0.0.1:8080/axis2/ (默认的端口) 出现Welcome 界面就OK.

6. 进入到 Administration 的界面 登录名 admin 密码 axis2

在Upload Service 页面中上传刚才建立的服务 HWS.aar 文件, 成功后就有服务HWS了.

在Available Services 页面会有 如下信息表示服务OK

HWS

Service EPR : http://127.0.0.1:8080/axis2/services/HWS
Service REST epr : http://127.0.0.1:8080/axis2/rest/HWS

Service Description : null

http://127.0.0.1:8080/axis2/services/HWS?wsdl 可看到其 WSDL文件。

7. 用CMD命令 进入到 axis2-std-1.0-bin.zip 解压包中执行:

       wsdl2java.bat -uri http://localhost:8080/axis2/services/HWS?wsdl -o F:\ -p Stub

将会在 F:\ 中生成一个src\Stub包 ,将其中的两个JAVA (HWSCallbackHandler.java   HWSStub.java )拷贝到 另一个测试客户端的工程中进行测试.

另外加一个JAVA测试类TestHWS,内容如下:

import Stub.HWSStub.EchoResponse;

public class TestHWS {

   public static void main(String[] args) throws Exception {
    HWSStub stub = new HWSStub();
    HWSStub.Echo request = new HWSStub.Echo();
    request.setValue(">>>>>>Client OK :::: "+new java.util.Date().toLocaleString()
      +"asdfsadfsadf "); 
    EchoResponse response = stub.echo(request);
    System.out.println("Response : " + response.get_return());
   }
}

测试结果: (没有配log4j)

log4j:WARN No appenders could be found for logger (org.apache.axiom.om.impl.builder.StAXOMBuilder).
log4j:WARN Please initialize the log4j system properly.
Response : Client OK :::: 2006-8-8 18:18:09asdfsadfsadf

OK!

posted @ 2007-11-05 21:10 路依 阅读(2669) | 评论 (6)编辑 收藏