<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    我的博客我做主

    我的未來不是夢!
    posts - 9, comments - 10, trackbacks - 0, articles - 0
      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

    2010年8月26日

    感謝大家都我博客的關注和關系,現在將博客遷移到www.v5cn.cn上面了,有興趣的童鞋可以到上面尋找自己感興趣的技術博文,主要包括WorldWind,Lucene等技術。www.v5cn.cn

    posted @ 2013-10-08 14:02 平常心 閱讀(174) | 評論 (0)編輯 收藏

    更多博客請查看:http://www.v5cn.cn
    在安裝好Sql Server2005后默認是不支持JTA分布式事務的,要進行一下額外的設置才可以支持JTA事務。
    那么如何讓Sql Server2005具有JTA事務那,那大家就跟我一步一步做吧!
    第一步:
        下載Sql Server2005的JDBC驅動。下載完成后得到的是一個exe文件:“sqljdbc_1.0.809.102_chs.exe”。
        雙擊打開:
        
        點擊Browse... 選擇要解壓的目錄。解壓后得到:
        
        其中:sqljdbc.jar是Java連接Sql Server2005的驅動程序。
        打開xa目錄:
        
        可以看到x64目錄和x86目錄和xa_install.sql文件
        我們這里選擇x86也就是32位的機器。打開可以看到sqljdbc_xa.dll文件
        復制該文件到Sql Server2005的安裝目錄中的Binn文件夾下面。(Sql Server2005的安裝目錄下面有很多Binn,我也不知道那個復制那個不復制,所以我就都復制了。
        有知道的朋友可以回復告訴大家和我!)
    第二步:
        打開操作系統win7和XP:
            win7下面是:控制面板--> 系統和安全-->管理工具-->組件服務-->計算機-->Distributed Transaction Coordinator-->右鍵,【本地DTC】,【屬性】選擇【安全】勾選
            啟用XA事務,點擊確認。服務會重啟。
            XP:控制面板-->管理工具-->組件服務-->計算機-->我的電腦-->右鍵,【屬性】如圖:
            
            
            勾選【啟用XA事務】點擊確定完成。
    第三步:
        復制xa_install.sql到Sql Server2005的查詢分析器中執行會創建一個角色:sqlJDBCXAUser
        因為Sql Server2005默認的超級管理員sa無法綁定sqlJDBCXAUser,所以我們重新創建一個超級管理員名稱dba
        然后把sqlJDBCXAUser授權給他就可以了:
        1. 創建用戶和授權:
            a). 創建用戶:
                
                b). 登錄名的基本配置:
                    
                    
                    
        點擊確認用戶創建成功!重啟數據庫服務。
        使用剛創建的用戶登錄。使用JTA分布式事務時也使用該用戶登錄,就OK了!

    posted @ 2010-10-15 15:16 平常心 閱讀(2420) | 評論 (0)編輯 收藏

    更多博客請查看:http://www.v5cn.cn
    1.創建一個Web工程,添加Struts2支持。
    2.創建兩個實體類:
    a). Mother(母親)的Java類。
    package struts.map.entity;

    import java.io.Serializable;

    public class Mother implements Serializable {

    private static final long serialVersionUID = 1L;

    private int motherId;        //母親ID
        private String motherName;        //母親名字
        public int getMotherId() {
    return motherId;
    }
    public void setMotherId(int motherId) {
    this.motherId = motherId;
    }
    public String getMotherName() {
    return motherName;
    }
    public void setMotherName(String motherName) {
    this.motherName = motherName;
    }
    }

    b).Children(孩子)的Java類

    package struts.map.entity;

    import java.io.Serializable;

    public class Children implements Serializable {

    private static final long serialVersionUID = 1L;

    private int childId;        //孩子ID
        private int motherId;        //母親的ID
        private String childName;        //孩子名字
        
    public int getChildId() {
    return childId;
    }
    public void setChildId(int childId) {
    this.childId = childId;
    }
    public int getMotherId() {
    return motherId;
    }
    public void setMotherId(int motherId) {
    this.motherId = motherId;
    }
    public String getChildName() {
    return childName;
    }
    public void setChildName(String childName) {
    this.childName = childName;
    }
    }

     

    3. 創建一個Action,并創建一位母親和她的孩子。

    package struts.map.test;

    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;

    import struts.map.entity.Children;
    import struts.map.entity.Mother;

    import com.opensymphony.xwork2.ActionSupport;

    public class Struts2_Map extends ActionSupport {

    private static final long serialVersionUID = 1L;

    private Map<Mother,List<Children>> motherChildn;

    public Map<Mother, List<Children>> getMotherChildn() {
    return motherChildn;
    }

    @Override
    public String execute() throws Exception {
    /*-------------------以對象做父節點的鍵,List做子節點的值,的Map-----------------------*/
    Mother mother 
    = new Mother();
    mother.setMotherId(
    10000);
    mother.setMotherName(
    "花木蘭");

    Children children1 
    = new Children();
    children1.setChildId(
    10000);
    children1.setMotherId(
    10000);
    children1.setChildName(
    "小花木蘭1");

    Children children2 
    = new Children();
    children2.setChildId(
    10001);
    children2.setMotherId(
    10000);
    children2.setChildName(
    "小花木蘭2");

    Children children3 
    = new Children();
    children3.setChildId(
    10002);
    children3.setMotherId(
    10000);
    children3.setChildName(
    "小花木蘭3");

    motherChildn 
    = new HashMap<Mother,List<Children>>();

    List
    <Children> childrens = new ArrayList<Children>();

    childrens.add(children1);
    childrens.add(children2);
    childrens.add(children3);

    motherChildn.put(mother,childrens);

    return SUCCESS;
    }
    }

    struts.xml
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
    <struts>
    <package name="map" extends="struts-default">
    <action name="struts_map" class="struts.map.test.Struts2_Map">
    <result>result.jsp</result>
    </action>
    </package>
    </struts>  

    4.創建兩個頁面:
    a).跳轉頁面:
    <%@ page language="java" pageEncoding="UTF-8"%>
    <%
    String path = request.getContextPath();
    %>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>

    <title>Struts_Map</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    </head>

    <body>
    <href="struts_map.action">查看Map</a>
    </body>
    </html>

    b).最終頁面,也是作重要的頁面:
    <%@ page language="java" pageEncoding="UTF-8"%>
    <%@taglib uri="/struts-tags" prefix="s" %>
    <%
    String path = request.getContextPath();
    %>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>

    <title>Struts_Map</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    </head>

    <body>
    <div>
    <h3>-----------------以對象做父節點的鍵,List做子節點的值,的Map--------------------</h3>
    <s:iterator var="mc" value="motherChildn">
    <div>
    母親名稱:
    <s:property value="key.motherName"/>
    </div>
    <s:iterator var="ch" value="value">
    <div>
    &nbsp;&nbsp;&nbsp;孩子名稱:<s:property value="#ch.childName"/>
    </div>
    </s:iterator>
    </s:iterator>
    </div>
    </body>
    </html>

    最終運行結果:

    posted @ 2010-08-26 22:18 平常心 閱讀(6906) | 評論 (0)編輯 收藏

    主站蜘蛛池模板: 亚洲高清无在码在线电影不卡 | 无码专区—VA亚洲V天堂| 国产精品亚洲精品久久精品 | 成人永久免费高清| 久久精品国产99国产精品亚洲| 91av视频免费在线观看| 色婷婷亚洲十月十月色天| 久久久久久久99精品免费观看 | 天天摸夜夜摸成人免费视频| 亚洲大香伊人蕉在人依线| 国产成人A人亚洲精品无码| 免费播放在线日本感人片| 亚洲成a人片在线观看无码| 久久99青青精品免费观看| 亚洲精品美女视频| 国产精品成人免费一区二区 | 亚洲精品国产va在线观看蜜芽| 免费无码国产在线观国内自拍中文字幕 | 亚洲日韩精品射精日| 亚洲日韩av无码中文| 国产成人免费片在线观看| 亚洲国色天香视频| 噼里啪啦电影在线观看免费高清| 亚洲国产日韩a在线播放| jizzjizz亚洲| 免费A级毛片无码专区| 亚洲一区二区三区国产精华液| 日本高清免费不卡在线| 国产无遮挡色视频免费观看性色| 卡一卡二卡三在线入口免费| 美女被暴羞羞免费视频| 精品久久久久久亚洲| 亚洲高清中文字幕免费| 午夜亚洲国产精品福利| 国产亚洲综合一区柠檬导航| 99re热免费精品视频观看| j8又粗又长又硬又爽免费视频 | 理论亚洲区美一区二区三区| 亚洲国产一二三精品无码| 最近免费中文字幕大全视频| 久久WWW免费人成—看片|