'전체'에 해당되는 글 544건

  1. [Easyui] ComboTree [모음]
  2. There is no WRITEABLE property named 에러
  3. 톰캣 오류 Starting Tomcat v7.0 Server at localhost has encountered a problem
  4. 티스토리 추천추천~

[Easyui] ComboTree [모음]

combotree에 관한 인터넷정보 끌어모음


예 이미지: http://www.jeasyui.com/documentation/images/combotree.png

<EXamples>

<input class="easyui-combotree" method='get' data-options="url:'../combotree/tree_data1.json',required:true" style="width:200px;"> 

$('#code').combotree({
			url:"<c:url value='/manage/comboTreeJson.do'/>",
			valueField:'code',
			textField:'name',
			method:'get'

......

});


[{
	"id":1,
	"text":"My Documents",
	"children":[{
		"id":11,
		"text":"Photos",
		"state":"closed",
		"children":[{
			"id":111,
			"text":"Friend"
		},{
			"id":112,
			"text":"Wife"
		},{
			"id":113,
			"text":"Company"
		}]
	},{
		"id":12,
		"text":"Program Files",
		"children":[{
			"id":121,
			"text":"Intel"
		},{
			"id":122,
			"text":"Java",
			"attributes":{
				"p1":"Custom Attribute1",
				"p2":"Custom Attribute2"
			}
		},{
			"id":123,
			"text":"Microsoft Office"
		},{
			"id":124,
			"text":"Games",
			"checked":true
		}]
	},{
		"id":13,
		"text":"index.html"
	},{
		"id":14,
		"text":"about.html"
	},{
		"id":15,
		"text":"welcome.html"
	}]
}]

4.JSON format 
Java code
  1. [{
  2. "Id": 1,
  3. "Text": "Folder1"
  4. "IconCls": "icon-ok",
  5. "Children": [{
  6. "Id": 2,
  7. "Text": "File1"
  8. "Checked": true   
  9. , {
  10. "Id": 3,
  11. "Text": "Folder2",
  12. "State": "open",
  13. "Children": [{
  14. "Id": 4
  15. "Text": "File3",
  16. "Attributes": {
  17. "P1": "value1",
  18. "P2": "value2"   
  19. },
  20. "Checked": true,
  21. "IconCls": "icon-reload"   
  22. , {
  23. "Id": 8,
  24. "Text": "Async Folder",
  25. "State": "closed"   
  26. }]
  27. }]
  28. , {
  29. "Text": "Languages",
  30. "State": "closed",
  31. "Children": [{
  32. "Id": "j1",
  33. "Text": "Java"   
  34. , {
  35. "Id": "j2",
  36. "Text": "C #"   
  37. }]
  38. }]


  1. package edu.njupt.zhb.model;  
  2.   
  3. import java.util.List;  
  4.   
  5. public class ComboTreeModel {  
  6.     private int id;  
  7.     private String text;  
  8.     private List<ComboTreeModel> children;  
  9.     public int getId() {  
  10.         return id;  
  11.     }  
  12.     public void setId(int id) {  
  13.         this.id = id;  
  14.     }  
  15.     public String getText() {  
  16.         return text;  
  17.     }  
  18.     public void setText(String text) {  
  19.         this.text = text;  
  20.     }  
  21.     public List<ComboTreeModel> getChildren() {  
  22.         return children;  
  23.     }  
  24.     public void setChildren(List<ComboTreeModel> children) {  
  25.         this.children = children;  
  26.     }  
  27. }  



  1. package edu.njupt.zhb.action;  
  2.   
  3. import java.io.IOException;  
  4. import java.io.PrintWriter;  
  5. import java.util.ArrayList;  
  6. import java.util.List;  
  7.   
  8. import javax.servlet.http.HttpServletResponse;  
  9. import org.apache.struts2.ServletActionContext;  
  10. import com.opensymphony.xwork2.ActionSupport;  
  11.   
  12. import edu.njupt.zhb.model.ComboTreeModel;  
  13. import net.sf.json.JSONArray;  
  1. public class CombotreeDemoAction extends ActionSupport {  
  2.     /** 
  3.      *  
  4.      */  
  5.     private static final long serialVersionUID = -3318989776253565435L;  
  6.     /** 
  7.      * 
  8.      *  
  9.      * @return 
  10.      */  
  11.     public void getTreeData(){  
  12.         List<ComboTreeModel> list = new ArrayList<ComboTreeModel>();  
  13.         for(int i = 1;i<10;i++){  
  14.             ComboTreeModel ctm = new ComboTreeModel();  
  15.             ctm.setId(i);  
  16.             ctm.setText("树节点"+i);  
  17.             if(i == 2){  
  18.                 List<ComboTreeModel> children = new ArrayList<ComboTreeModel>();  
  19.                 for (int j = 1; j < 6; j++) {  
  20.                     ComboTreeModel comboTreeModel = new ComboTreeModel();  
  21.                     comboTreeModel.setId(j);  
  22.                     comboTreeModel.setText("子节点"+i+j);  
  23.                     children.add(comboTreeModel);  
  24.                 }  
  25.                 ctm.setChildren(children);  
  26.             }  
  27.             list.add(ctm);  
  28.         }  
  29.         System.out.println("----json--");  
  30.         String json = JSONArray.fromObject(list).toString();//JSON  
  31.         getPrintWriter().write(json);//  
  32.     }  
  33.     /** 
  34.      * 
  35.      *  
  36.      * @return 
  37.      */  
  38.     public static HttpServletResponse getResponse() {  
  39.         HttpServletResponse response = ServletActionContext.getResponse();  
  40.         response.setContentType("text/html;charset=UTF-8");  
  41.         return response;  
  42.     }  
  43.   
  44.     public PrintWriter getPrintWriter() {  
  45.         PrintWriter pw = null;  
  46.         try {  
  47.             pw = getResponse().getWriter();  
  48.         } catch (IOException e) {  
  49.             e.printStackTrace();  
  50.         }  
  51.         return pw;  
  52.     }  
  53.   
  54. }  

Markup

<select id="cc" style="width:200px;"></select>

jQuery

$('#cc').combotree({
    url:'tree_data.json'
});

Dependencies

  • tree

Options

Override defaults with $.fn.combotree.defaults.

Properties

NameTypeDescriptionDefault
widthnumberThe width of the component.auto
treeWidthnumberThe width of the tree list.null
treeHeightnumberThe height of the tree list.null
urlstringA URL to load remote tree data.null

Events

NameParametersDescription
onSelectnodeFires when user select a tree node.
onChangenewValue, oldValueFires when the field value is changed.

Methods

NameParameterDescription
setValueparamSet the specified value into the field. The 'param' parameter can be a tree node id value or a javascript object that contains two properties: id and text.
getValuenoneGet the field value.
reloadurlRequest the remote tree data again.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ComboTree - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../themes/icon.css">
<link rel="stylesheet" type="text/css" href="demo.css">
<script type="text/javascript" src="../jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../jquery.easyui.min.js"></script>
<script>
function reload(){
$('#cc').combotree('reload');
}
function setValue(){
$('#cc').combotree('setValue', 2);
}
function getValue(){
var val = $('#cc').combotree('getValue');
alert(val);
}
function disable(){
$('#cc').combotree('disable');
}
function enable(){
$('#cc').combotree('enable');
}
</script>
</head>
<body>
<h2>ComboTree</h2>
<div class="demo-info">
<div class="demo-tip icon-tip"></div>
<div>Click the right arrow button to show the tree.</div>
</div>
<div style="margin:10px 0;">
<a href="#" class="easyui-linkbutton" onclick="reload()">Reload</a>
<a href="#" class="easyui-linkbutton" onclick="setValue()">SetValue</a>
<a href="#" class="easyui-linkbutton" onclick="getValue()">GetValue</a>
<a href="#" class="easyui-linkbutton" onclick="disable()">Disable</a>
<a href="#" class="easyui-linkbutton" onclick="enable()">Enable</a>
</div>
<p>Single Select</p>
<input id="cc" class="easyui-combotree" value="2" data-options="url:'tree_data.json',required:true" style="width:200px;">
<p>Multiple Select</p>
<select class="easyui-combotree" name="language" data-options="url:'tree_data.json',cascadeCheck:false" multiple style="width:200px;"></select>
</body>
</html>




tree nodes

function Travel(treeID){//参数为树的ID,注意不要添加#
   var roots=$('#'+treeID).tree('getRoots'),children,i,j;
   for(i=0;i<roots.length;i++){
     alert(roots[i].text);
     children=$('#'+treeID).tree('getChildren',roots[i].target);
     for(j=0;j<children.length;j++)alert(children[j].text);
   }
}     

 

       $(function(){
                $('#tt2').tree({
                    checkbox: true,
                    url: 'tree_data.json',
                    onClick: function(node){
                        $(this).tree('toggle', node.target);
                        //alert('you dbclick '+node.text);
                    },
                    onContextMenu: function(e, node){
                        e.preventDefault();
                        $('#tt2').tree('select', node.target);
                        $('#mm').menu('show', {
                            left: e.pageX,
                            top: e.pageY
                        });
                    }
                });
            });
            function reload(){
                var node = $('#tt2').tree('getSelected');
                if (node) {
                    $('#tt2').tree('reload', node.target);
                }
                else {
                    $('#tt2').tree('reload');
                }
            }
            
            function getChildren(){
                var node = $('#tt2').tree('getSelected');
                if (node) {
                    var children = $('#tt2').tree('getChildren', node.target);
                }
                else {
                    var children = $('#tt2').tree('getChildren');
                }
                var s = '';
                for (var i = 0; i < children.length; i++) {
                    s += children[i].text + ',';
                }
                alert(s);
            }
            
            function getChecked(){
                var nodes = $('#tt2').tree('getChecked');
                var s = '';
                for (var i = 0; i < nodes.length; i++) {
                    if (s != '') 
                        s += ',';
                    s += nodes[i].text;
                }
                alert(s);
            }
            
            function getSelected(){
                var node = $('#tt2').tree('getSelected');
                alert(node.text);
            }
            
            function collapse(){
                var node = $('#tt2').tree('getSelected');
                $('#tt2').tree('collapse', node.target);
            }
            
            function expand(){
                var node = $('#tt2').tree('getSelected');
                $('#tt2').tree('expand', node.target);
            }
            
            function collapseAll(){
                var node = $('#tt2').tree('getSelected');
                if (node) {
                    $('#tt2').tree('collapseAll', node.target);
                }
                else {
                    $('#tt2').tree('collapseAll');
                }
            }
            
            function expandAll(){
                var node = $('#tt2').tree('getSelected');
                if (node) {
                    $('#tt2').tree('expandAll', node.target);
                }
                else {
                    $('#tt2').tree('expandAll');
                }
            }
            
            function append(){
                var node = $('#tt2').tree('getSelected');
                $('#tt2').tree('append', {
                    parent: (node ? node.target : null),
                    data: [{
                        text: 'new1',
                        checked: true
                    }, {
                        text: 'new2',
                        state: 'closed',
                        children: [{
                            text: 'subnew1'
                        }, {
                            text: 'subnew2'
                        }]
                    }]
                });
            }
            
            function remove(){
                var node = $('#tt2').tree('getSelected');
                $('#tt2').tree('remove', node.target);
            }
            
            function update(){
                var node = $('#tt2').tree('getSelected');
                if (node) {
                    node.text = '<span style="font-weight:bold">new text<\/span>';
                    node.iconCls = 'icon-save';
                    $('#tt2').tree('update', node);
                }
            }
            
            function isLeaf(){
                var node = $('#tt2').tree('getSelected');
                var b = $('#tt2').tree('isLeaf', node.target);
                alert(b)
            }
            
            function GetNode(type){
                var node = $('#tt2').tree('getChecked');
                var chilenodes = '';
                var parantsnodes = '';
                var prevNode = '';
                for (var i = 0; i < node.length; i++) {
                
                    if ($('#tt2').tree('isLeaf', node[i].target)) {
                        chilenodes += node[i].text + ',';
                        
                        var pnode = $('#tt2').tree('getParent', node[i].target);
                        if (prevNode != pnode.text) {
                            parantsnodes += pnode.text + ',';
                            prevNode = pnode.text;
                        }
                    }
                }
                chilenodes = chilenodes.substring(0, chilenodes.length - 1);
                parantsnodes = parantsnodes.substring(0, parantsnodes.length - 1);
                
                if (type == 'child') {
                    return chilenodes;
                }
                else {
                    return parantsnodes
                };
                };
            function getNodes(){
                alert(GetNode('fnode') + "," + GetNode('child'));
            }
            
            function doNode(){
      var c="";
      var p="";
      $(".tree-checkbox1").parent().children('.tree-title').each(function(){
        c+=$(this).parent().attr('node-id')+",";
      });
       $(".tree-checkbox2").parent().children('.tree-title').each(function(){
     p+=$(this).parent().attr('node-id')+",";
      });
      var str=(c+p);
      str=str.substring(0,str.length-1);
      alert(str);
            }




function Travel(treeID){ var roots=$('#'+treeID).tree('getRoots'),children,i,j; for(i=0;i<roots.length;i++){ alert(roots[i].text); children=$('#'+treeID).tree('getChildren',roots[i].target); for(j=0;j<children.length;j++)alert(children[j].text); } }

sqlMap에서 

There is no WRITEABLE property named 에러 ... 뒤에 변수를 잘 확인하시고

VO에 해당 변수가 선언되어 있지 않은 경우 입니다.

또는 resultMap에 선언한 property와 VO(Bean)의 변수명의 대소문자 구분이 달라서 나는 오류입니다.




 port 8005, 8080, 8009가 이미 사용되고 있고 있으며 서버를 사용하고 싶으면 프로세스를 중지하거나 포트넘버를 바꾸라는 내용 같습니다.


간단해결방법 셧다운하면됩니다.

톰캣이 깔려있는 폴더에 bin안에 shutdown 배치파일 클릭! 한방에 끝. 

다시 서버를 구동해보면 됩니다.

티스토리 추천추천~



http://tistory.com     티스토리 url 테스트


 고멘네