日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

一个easyui的案例(SSH)

發布時間:2024/9/27 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 一个easyui的案例(SSH) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

/*
?* name :tuzuoquan mail :tuzq@css.com.cn date :2014/02/14 version :0.1
?* description:氣象信息共享門戶系統通用JS,TreeTable CopyRight (C) 2014-02
?*/
// 獲取選中一行的情況,下面的一個參數可以代表一個DataGrid
function getSelected(dialogEle) {
?// 獲取選中一行的情況。
?var datagrid = $("#fileInfoDataGrid").datagrid('getSelected');
//?alert(datagrid.fileName + " " + datagrid.filePath + " "
//???+ datagrid.lastModified + " " + datagrid.fileType);
?if(datagrid == null){
??alert("對不起!您還沒有選擇文件!");
?} else {
??if(datagrid.fileType == "文件夾"){
???alert("對不起,您選擇的是文件夾,請您選擇確切的文件!");
??} else {
???//alert($(".service1 #path").length);
???//給這個文本域賦值
???$(".service1 #path").attr("value",datagrid.filePath);
???dialogEle.dialog("close");
??}
?}
}

// 獲取選中多行的情況
function getSelections() {
?var ids = [];
?var rows = $("#fileInfoDataGrid").datagrid('getSelections');
?for (var i = 0; i < rows.length; i++) {
??ids.push(rows[i].filePath);
?}

?alert(ids.join(':'));
}

//選中指定行
function selectRow(rowNum){
?$("#fileInfoDataGrid").datagrid('selectRow',rowNum);
}

//不選中指定行
function unselectRow(rowNum){
?$("#fileInfoDataGrid").datagrid('unselectRow',rowNum);
}

function clearSelections(){
?$("#fileInfoDataGrid").datagrid('clearSelections');
}

$(function() {
?$("#dialog-diskFileInfo").dialog({
??resizable : false,
??height : 500,
??minHeight : 150,
??width : 1015,
??modal : true,
??show : "blind",
??hide : "explode",
??closeOnEscape : true,
??autoOpen : false,
??draggable : true,
??buttons : {
???"確定" : function() {
????$.fn.diskFileDialogEleBtnCheckOk($(this),
??????$("#diskFileStructureTree"), $("#fileInfoDataGrid"));
???},
???"取消" : function() {
????$(this).dialog("close");
???}
??}
?});

?// 帶有class屬性為openDiskFileInfoDialog的元素,為這個元素添加點擊事件
?$("#openDiskFileInfoDialog").bind("click", function() {
??// 加載數據
??$("#diskFileStructureTree").tree({
???height : 355,
???checkbox : false,
???url : basePath + "/onlinegraph/treeDataAction_treeNodes.action",
???method : 'post',
???animate : true,
???dnd : true,
???lines : true,
???onClick : function(node) {
//????$("#fileInfoDataGrid").datagrid({
//?????// 通過這個獲得參數
//?????url : basePath
//???????+ "/onlinegraph/fileInfoAction_folderFileInfoList.action?path=" + node.id,
//?????method : 'post'
//????});
????
????$("#fileInfoDataGrid").datagrid('load', {
???????page : 1,
???????pageSize : "10",
???????path:node.id
??????});
????
????//$("#fileInfoDataGrid").datagrid('reload');
???},
???onBeforeExpand : function(node, param) {
????$("#diskFileStructureTree").tree('options').url = basePath
??????+ "/onlinegraph/treeDataAction_treeNodeList.action?path="
??????+ node.id;
???}
??});

??// 打開表格
??$("#fileInfoDataGrid").datagrid({
???height:325,
???width:815,
???// 通過這個獲得參數
???url : basePath
?????+ "/onlinegraph/fileInfoAction_folderFileInfoList.action",
???// 行陰影,但目前看沒有效果
???striped : true,
???method : 'post',
???nowrap : false,
???border : false,
???singleSelect : true,
???// 自適應窗口大小變化
???fit : true,
???title : '文件信息',
???fitColumns : true,
???rownumbers : true,
???idField : 'filePath',
???collapsible : true,
???sortName:'fileName',
???// 排序規則
???sortOrder : 'desc',
???// 本地排序,不是在服務器端排
???remoteSort : false,
???frozenColumns : [[{
??????field : 'checkbox',
??????checkbox : true
?????}]],
???columns : [[{
??????field : 'fileName',
??????title : '名稱',
??????sortable : true,
??????sortable : true,
??????width : 50
?????}, {
??????field : 'filePath',
??????title : '文件路徑',
??????sortable : true,
??????sortable : true,
??????width : 160
?????}, {
??????field : 'lastModified',
??????title : '修改日期',
??????sortable : true,
??????sortable : true,
??????width : 100
?????}, {
??????field : 'fileType',
??????title : '類型',
??????sortable : true,
??????width : 50,
??????align : 'left'
?????}, {
??????field : 'fileSize',
??????title : '大小',
??????sortable : true,
??????width : 50,
??????align : 'left'
?????}]],
???// 事件調用的方式
???onLoadSuccess : function() {
???},
???onDblClickRow:function(index,row){
????//alert("index == " + index + " row == " + row.filePath);
????
????if(row.fileType == "文件夾"){
?????alert("對不起,您選擇的是文件夾,請您選擇確切的文件!");
????} else {
?????//alert($(".service1 #path").length);
?????//給這個文本域賦值
?????$(".service1 #path").attr("value",row.filePath);
?????$("#dialog-diskFileInfo").dialog("close");
????}
???},
???pagination : true
??});

??var p = $("#fileInfoDataGrid").datagrid('getPager');
??$(p).pagination({
???pageList:[5,10,20,30,40,50,100],
???//layout:['list','sep','first','prev','links','next','last','sep','refresh'],
???beforePageText : '第',
???afterPageText : '頁? 共{pages}頁',
???displayMsg : '當前顯示 {from} - {to} 條記錄?? 共 {total} 條記錄',
???showPageList:true,
???showRefresh:true,
???onSelectPage : function(pageNumber, pageSize) {
????$(this).pagination('loading');
????$(this).pagination('loaded');
????
????// 選擇相應的頁碼時刷新顯示內容列表
????$("#fileInfoDataGrid").datagrid('load', {
???????page : pageNumber,
???????pageSize : pageSize
??????});

????$("#fileInfoDataGrid").datagrid('reload');

????// $("#fileInfoDataGrid").datagrid({
????// //通過這個獲得參數
????// url: basePath +
????// "/onlinegraph/fileInfoAction_folderFileInfoList.action?page="
????// + pageNumber + "&pageSize=" + pageSize,
????// method:'post'
????// });
???},
???onBeforeRefresh : function(pageNumber, pageSize) {
????// 刷新觸發事件
????$(this).pagination('loading');
????$(this).pagination('loaded');
???},
???onRefresh : function(pageNumber, pageSize) {
????//alert("pageNumber = " + pageNumber + " pageSize = " + pageSize);
????// 上一頁觸發事件
????$("#fileInfoDataGrid").datagrid('load', {
???????page : pageNumber,
???????pageSize : pageSize
??????});

????$(this).pagination('loading');
????$(this).pagination('loaded');

????$("#fileInfoDataGrid").datagrid('reload');
???},
???onChangePageSize : function(pageSize) {
????$(this).pagination('loading');
??????????????? $(this).pagination('loaded');
???}
??});

??$("#dialog-diskFileInfo").dialog("open");
?});

?// 插件的第一個參數表示的是彈出的dialog元素
?$.fn.diskFileDialogEleBtnCheckOk = function(dialogEle,
???diskFileStructureTree, fileInfoDataGrid) {

??// 獲得選中列
??getSelected(dialogEle);
????
??//獲取選中多行的信息
??//getSelections();
??
??//選中第二行
??//selectRow(2);
????
??//不選中第三行
??//unselectRow(2);
??
??//清除所有的選中行
??//clearSelections();
?}
});

?

struts2配置:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE struts PUBLIC
??????? "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
??????? "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
?<package name="system_onlinegraph" namespace="/onlinegraph" extends="global-struts-default">
??<action name="treeDataAction_*" class="cn.com.css.misps.onlinegraph.web.action.TreeDataAction" method="{1}">
???<result name="treeNodes" type="json">
????<param name="root">treeList</param>
???</result>
???<result name="treeNodeList" type="json">
????<param name="root">treeNodeList</param>
???</result>
??</action>
??
??<action name="fileInfoAction_*" class="cn.com.css.misps.onlinegraph.web.action.FileInfoAction" method="{1}">
???<result type="json"></result>
??</action>
??? </package>
</struts>

?

?

?

action的寫法:

package cn.com.css.misps.onlinegraph.web.action;

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

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import cn.com.css.common.action.BaseAction;
import cn.com.css.misps.onlinegraph.bean.TreeDataBean;
import cn.com.css.misps.onlinegraph.service.ITreeDataService;
import cn.com.css.misps.onlinegraph.service.impl.TreeDataServiceImpl;
import cn.com.css.misps.onlinegraph.util.ProductsStorageUtils;

/**
?* @brief FileInfoAction.java 通過這個類查看文件夾下的文件信息
?* @attention
?* @author 涂作權
?* @date 2014-2-25
?* @note begin modify by null
?*/
@SuppressWarnings("serial")
@Scope("prototype")
@Controller
public class FileInfoAction extends BaseAction {
?private int total = 0;
?private List<Object> rows;
?private String path;
?private String page;
?private String pageSize;
?
?/**
? * \brief 通過此方法返回指定文件夾下的文件信息
? *
? * @return
? * @attention
? * @author 涂作權
? * @date 2014-2-25
? * @note begin modify by null
? */
?public String folderFileInfoList() {
??rows = new ArrayList<Object>();
??ITreeDataService treeDataService = new TreeDataServiceImpl();

??// 如果path為空,顯示的是根目錄的文件信息
??List<TreeDataBean> list = null;
??
??//先獲得當前頁和每頁大小,如果在
??int intPage = Integer.parseInt((page == null || page == "0") ? "1":page);
??System.out.println("intPage? ==? "+intPage);
??
??if (path == null) {
???// 如果path為空,顯示的是根目錄的文件信息
???list = treeDataService.getAllFileList(ProductsStorageUtils.micapsAbsolutePath);
??} else {
???// 如果文件路徑是空,查詢指定目錄下的文件信息
???list = treeDataService.getAllFileList(path);
??}
??
??//每頁顯示條數
??int number = Integer.parseInt((pageSize == null || pageSize == "0") ? "10":pageSize);
??
??if ((pageSize == null || pageSize == "0")) {
???pageSize = "10";
???page = "1";
??}
??
??//每頁的開始記錄? 第一頁為1, 第二頁為number+1
??int start = (intPage - 1) * number;
??int end = ((start + number) < list.size()) ? start + number : list.size();
??
??//注意要將每個對象的內容放到map集合中,然后將每個map放到rows集合中
??for (int i = start; i < end; i++) {
???Map<String, Object> map = new HashMap<String, Object>();
???map.put("fileName", list.get(i).getFileName());
???map.put("filePath", list.get(i).getFilePath());
???map.put("lastModified", list.get(i).getLastModified());
???map.put("fileType", list.get(i).getFileType());
???map.put("fileSize", list.get(i).getFileSize());
???rows.add(map);
??}
??
??total = list.size();
??
??return SUCCESS;
?}

?/**
? * @return the total
? */
?public int getTotal() {
??return total;
?}

?/**
? * @param total the total to set
? */
?
?public void setTotal(int total) {
??this.total = total;
?}

?/**
? * @return the rows
? */
?public List<Object> getRows() {
??return rows;
?}

?/**
? * @param rows the rows to set
? */
?
?public void setRows(List<Object> rows) {
??this.rows = rows;
?}

?/**
? * @return the path
? */
?public String getPath() {
??return path;
?}

?/**
? * @param path the path to set
? */
?
?public void setPath(String path) {
??this.path = path;
?}

?/**
? * @return the page
? */
?public String getPage() {
??return page;
?}

?/**
? * @param page the page to set
? */
?
?public void setPage(String page) {
??this.page = page;
?}

?/**
? * @return the pageSize
? */
?public String getPageSize() {
??return pageSize;
?}

?/**
? * @param pageSize the pageSize to set
? */
?
?public void setPageSize(String pageSize) {
??this.pageSize = pageSize;
?}
}

總結

以上是生活随笔為你收集整理的一个easyui的案例(SSH)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。