- 浏览: 93929 次
- 性别:
- 来自: 广州
-
最新评论
-
onleoneggp:
...
MyEclipse for spring 注册码 -
9976:
谢谢。可以用。
myeclipse 8.6 M1 注册码 收藏 -
greatghoul:
请教,如果xml是utf-8格式的,如何在属性中写入中文.
简单的Dom4j写入XML文件例子 -
fffddgx:
不错 有收获,谢谢
报错信息 -
lufei_vs:
引用
利用反射机制模拟Hibernate的Session
文章列表
文件上传的方法有很多,可以基于commons-fileupload+commons-io的,其实也有基于cos.jar的方法,Jar 可以去http://www.servlets.com/cos/index.html 下载.
下面就以一个简单的图片上传+根据具体选项修改文件名的方法:
1.先写一个servlet类:
package com.lee.util;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
...
package com.lee.util;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class ClientTreeReader {
private StringBuffer sbTree = new StringBuffer();
public String read() {
Connection conn = null;
t ...
如果需要在查询语句返回的列中包含一列表示该条记录在整个结果集中的行号, ISO SQL:2003 标准提出的方法是提供ROW_NUMBER() / RANK() 函数。 Oracle 中可以使用标准方法(8i版本以上),也可以使用非标准的 ROWNUM ; MS SQL Server 则在 2005 版本中提供了 ROW_NUMBER() 函数;但在 MySQL 中似乎还没有这样的系统自带功能。虽然 LIMIT 可以很方便的对返回的结果集数量和位置进行过滤,但过滤出来的记录的行号却没办法被 SELECT 到。据说MySQL 是早就想增加这个功能了,但我是还没找到。
GridPanel上显示数据,可以使用Struts,也可以使用Servlet的方法,两者的用法相近,所以,给出后者的实现方法:
这里先列出HTML代码:
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+requ ...
<html>
<head>
<title>Accordion Layout</title>
<link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css"/>
<link rel="stylesheet" type="text/css" href="tabs-example.css" ...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace detegateClass2
{
class StudentDelegate
{
private int score;
public delegate string DelegateResponse(int score);
public DelegateResponse delegateInstance;
...
不用委托思想的例子 :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace detegateClass2
{
class Student
{
private int score;
private ResponseScore responseScore;
/// <summary>
/// ...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace detegateClass1
{
class Student
{
private string name;
private decimal score;
public Student(string name, decimal score)
{
this.name = n ...
报错信息:
java.lang.AbstractMethodError: com.microsoft.jdbc.base.BaseDatabaseMetaData.supportsGetGeneratedKeys()Z
解决:问谷老师得知是microsoft提供的数据库驱动存在bug。需要换一种驱动连接,使用jtds(下载地址:http://sourceforge.net/projects/jtds/files/)下载jtds1.2版,解压得到jtds-1.2.jar,引用到eclipse中项目目录下(去除原驱动引用),更改hibernate配置文件:
原驱动连接配置:
...
package com.quan.hibernate.model;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
/**
* Session的模拟
*/
public class create {
...
登陆框代码:
package com.erp.windows;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.Toolkit;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
imp ...
package TestConnection;
import java.sql.Connection;
import java.sql.DriverManager;
public class TestSQLServer {
public Connection getConnection() {
Connection conn = null;
//SQL Server 的默认端口是1433
String url = "jdbc:microsoft:SQLServer://localhost:1433;DatabaseName=DB_JXC&q ...
客户端 :
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.DataOutputStream;
import java.io.IOEx ...
客户端 :
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.DataOutputStream;
import java.io.IOEx ...