- 浏览: 29387 次
- 性别:
- 来自: 上海
文章列表
//网络资源下载 public void saveToFile(String destUrl, String fileName) throws IOException { FileOutputStream fos = null; BufferedInputStream bis = null; HttpURLConnection httpUrl = null; URL url = null; byte[] buf = new byte[1024]; int size = 0; // 链接 ...
/**
* 把字符串写到文件中
*/
public static void write2File(String str,String fileName){
File file = null;
OutputStreamWriter osWriter = null;
BufferedWriter bufferWriter = null;
try {
file = new File(fileName);
...
1,xml的生成与读取
package com.lee.dom4j;
import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;import java.io.UnsupportedEncodingException;import java.util.Iterator;import java.util.List;
import org.dom4j.Docume ...
1、在servlet中实现文件的下载
public class OpenFileAction extends Action {
private final String ENCODING= "utf-8"; private final String CONTENT_TYPE = "text/plain;charset=utf-8"; @Override public ActionForward execute(ActionMapping mapping, ActionForm form, ...
jQuery解析JSON,通过异步调用的方式从服务器端获取对象,并以Json格式显示在客户端
1、jsp
<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script> <script type="text/javascript"> $(function(){ $("#btn").click(function(){ $.post("GsonServle ...
1、$.post() 和$.ajax() 基本类似,但是更简化了一些。jQuery插件中,$.post底层最终调用的还是$.ajax():
2,jsp页面:
<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script> <script type="text/javascript"> $(function(){ $("#btn").click(function(){ ...
用jQuery解析xml文档:
1、xml.jsp
<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script> <script type="text/javascript"> $(function(){ $("#btn").click(function(){ $.ajax({ type: "POST", url: " ...
jQuery 中异步处理 之 $.ajax()的用法: 1、对应的jsp页面,引入jQuery插件: <script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script> <script type="text/javascript"> $(function(){ $("#btn").click(function(){ $.ajax({ type: "POST", ...
$.getJSON 的用法: //判断数据库一条记录中是否存在相同的planCode,cityCode, useType记录 function checkPlanConfig(planCode,cityCode,useType){ $.getJSON("getPlanConfigRecord.do",{"planCode":planCode,"cityCode":cityCode,"useType":useType},function(datas){ for(var i = 0;i<datas.le ...
jQuery datepicker用法
- 博客分类:
- jQuery
jQuery datepicker用法(个性化设置): $("#carContractBeginDate").datepicker({ minDate:+2, maxDate:+30, changeMonth: true, changeYear: true, dateFormat: 'yy-mm-dd', dayNamesMin:['日','一','二','三','四','五','六'], monthNamesShort:['1月','2月','3月','4月','5月','6月','7月','8月','9月','1 ...
张龙老师的Struts2学习总结
1、login.jsp
<s:form method="post" action="token" theme="simple">
username:<s:textfield name="username"></s:textfield><br>
password:<s:textfield name="password"></s:textfield><br>
<s:token& ...
JFreeChart练习
1,jsp页面
<body>
<h3>请选择喜欢的项目</h3>
<s:form action="viewResult">
<s:checkbox name="interest" label="足球" fieldValue="football" labelposition="left"/>
<s:checkbox name="interest" label=&qu ...
在struts2中实现文件的下载
1,download.jsp
<s:a href="/struts2/download.action">download</s:a>
2,struts.xml配置文件
<!-- 文件的下载功能 -->
<action name="download" class="com.test.action.DownLoadAction">
<result name="success" type="stream" ...
在struts2中实现多个文件的上传
1,upload.jsp
<%@ page language="java" pageEncoding="GB18030"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName() ...
Lean about Swing for JTree,A simple sample that you can add sibling,add child and delete a node...
1:TreeEditFrame.java
@SuppressWarnings("serial")
public class TreeEditFrame extends JFrame {
private JTree tree;
private DefaultTreeModel model;
private static final int DEFAULT_WIDTH = ...