原创 struts2中使用poi導出excel數據

struts配置文件 <action name="export" class="com.bos.ExportAction"> <result type="stream"> <param name="contentType">${co

原创 js四捨五入小數

function round(num,dec){      var strNum = num + '';/*把要轉換的小數轉換成字符串*/     var index = strNum.indexOf("."); /*獲取小數點的位置*/

原创 strut2 文件上傳

package com.ljq.action; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import ja

原创 encodeURI與encodeURIComponent的區別

encodeURI(String)主要用於整個URI(例如,http://www.jxbh.cn/illegal value.htm),而encodeURIComponent(String)主要用於對URI中的某一段(例如前面URI中的v

原创 servlet中使用commons-fileupload實現圖片上傳

1、引入commons-fileupload.jar包 2、html中form表單必須聲明enctype="multipart/form-data" <form action="<c:url value='/admin/AdminA

原创 fckeditor的簡單使用

<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <!-- 1,引入js文件 --> <script type

原创 查找文件

// 從classpath的根目錄中查找a.txt文件 this.getClass().getClassLoader().getResourceAsStream("a.txt"); // 從classpath的根目錄中查找a.txt文件

原创 servlet下使用c標籤分頁

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp

原创 網頁中播放聲音的例子

網頁中播放聲音的例子:使用標籤<bgsound> <span style="font-size:18px;"><html> <head> <title>Blank</title> <meta http-equiv="conte

原创 db2 導入與導出數據sql

--導出數據 export to e:\clcsjl.ixf of ixf select * from 表; --導入數據 import from e:\bgjcjl.ixf of ixf insert into 表; 點贊

原创 使用String日期和時間的格式化

//通過String的靜態方法format(String format, Object... args)實現日期格式化 String.format("%tF %<tT ", new Date()); 顯示結果:2014-11-22 22

原创 網頁中嵌入天氣預報

百度中搜索‘天氣定製模塊’,有很多免費提供天氣預報插件網站,其中有天氣網點擊打開鏈接,裏面提供多種樣式的天氣 例子:<iframe name="weather_inc" src="http://i.tianqi.com/index.php

原创 從源代碼角度看Struts2返回JSON數據的原理

轉載自http://yshjava.iteye.com/blog/1333602 用winrar打開struts2-json-plugin-xx.jar(筆者使用版本爲2.1.8.1),根目錄下有一個struts-plugin.xml,這

原创 分類模塊上移下移思路

分類模塊上移下移思路: 1、表中設計一個字段position用於表示位置(position的值不能重複,在添加時要指定一個位置號,要是當前最大值再加1) 2、列表顯示時按position升序排序 3、上移下移就是與上面或下面的對象交換po

原创 文件移動

方案一: apache下的工具類,FileUtils.copy(file,file),但不推薦,文件copy太慢 方案二: 移動文件,速度快,類File方法 file.renameTo(new File(path)) 例如: protec