2008年8月19日

<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 路依 阅读(539) | 评论 (0)编辑 收藏

2008年8月6日

<!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 路依 阅读(557) | 评论 (0)编辑 收藏

2007年11月5日

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 路依 阅读(2504) | 评论 (6)编辑 收藏

2007年11月1日

<%@ page language="java" pageEncoding="GB2312"%>
            <%
  //转载请保留以下信息,谢谢!
  //by tolys
  //本文出处: http://blog.csdn.net/tolys/archive/2007/10/06/1813197.aspx 
                int pagesize = 10;//每页显示记录数
                int liststep = 10;//最多显示分页页数
                int pages = 1;//默认显示第一页
                if (request.getParameter("pages") != null) {
                    pages = Integer.parseInt(request.getParameter("pages"));//分页页码变量
                }
                //sql="select count(*) from table";//取出记录总数,把*换成记录名性能更加
                int count = 305;//假设取出记录总数
                int pagescount = (int) Math.ceil((double) count / pagesize);//求总页数,ceil(num)取整不小于num
                if (pagescount < pages) {
                    pages = pagescount;//如果分页变量大总页数,则将分页变量设计为总页数
                }
                if (pages < 1) {
                    pages = 1;//如果分页变量小于1,则将分页变量设为1
                }
                int listbegin = (pages - (int) Math.ceil((double) liststep / 2));//从第几页开始显示分页信息
                if (listbegin < 1) {
                    listbegin = 1;
                }
                int listend = pages + liststep/2;//分页信息显示到第几页
                if (listend > pagescount) {
                    listend = pagescount + 1;
                }

                //显示数据部分
                int recordbegin = (pages - 1) * pagesize;//起始记录
                int recordend = 0;
                recordend = recordbegin + pagesize;
                //最后一页记录显示处理
                if (pages == pagescount) {
                    recordend = (int) (recordbegin + pagesize * (count % pagesize) * 0.1);
                }
                //Connection conn = null;//要测试显示数据请自己链接数据库
                //PreparedStatement stmt = null;
                //String strSql = "select * from usertable limit recordbegin,pagesize";//取出分页记录,SQL因数据库而异!
                //stmt = conn.prepareStatement(strSql);
                //ResultSet rs = stmt.executeQuery();
                //while(rs.next())){
                //    response.getWriter().println(""+rs.getString("userId")+"<br>");//显示取出的数据
                //}
                for (int i = recordbegin; i < recordend; i++) {
                    response.getWriter().println("record " + i + "<br>");
                }

                //显示数据部分

                //<显示分页信息
                //<显示上一页
                if (pages > 1) {
                    response.getWriter().println(
                    "<a href=?pages=" + (pages - 1) + ">上一页</a>");
                }//>显示上一页
                //<显示分页码
                for (int i = listbegin; i < listend; i++) {
                    if (i != pages) {//如果i不等于当前页
                        response.getWriter().println(
                        "<a href=?pages=" + i + ">[" + i + "]</a>");
                    } else {
                        response.getWriter().println("[" + i + "]");
                    }
                }//显示分页码>
                //<显示下一页
                if (pages != pagescount) {
                    response.getWriter().println(
                    "<a href=?pages=" + (pages + 1) + ">下一页</a>");
                }//>显示下一页
                //>显示分页信息
            %>

posted @ 2007-11-01 19:12 路依 阅读(1906) | 评论 (2)编辑 收藏
仅列出标题