java web开发中防止乱码的方法
1.在系统中导入一下source
SetCharacterEncodingFilter.java
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
//******************************************************
//システム名 販売システム
//機能名 日本語文字化け防止
//クラス名 SetCharacterEncodingFilter.java
//
//
//@author xiehl (Tomcatから転載)
//@version 2009.07.13 新規作成
//
//******************************************************
/**
* <p>Example filter that sets the character encoding to be used in parsing the
* incoming request, either unconditionally or only if the client did not
* specify a character encoding. Configuration of this filter is based on
* the following initialization parameters:</p>
* <ul>
* <li><strong>encoding</strong> - The character encoding to be configured
* for this request, either conditionally or unconditi
相关文档:
在
Java SE1.5
中,
增加了一个新的特性:泛型(日本语中的总称型)。何谓泛型呢?通俗的说,就是泛泛的指定对象所操作的类型,而不像常规方式一样使用某种固定的类型去指定。
泛型的本质就是将所操作的数据类型参数化,也就是说,该数据类型被指定为一个参数。这种参数类型可以使用在类、接口以及方法定义中。
......
问题域:
--系统中你需要获得某个类的唯一实例,所有客户端对它的访问都将通过一个公共的访问点获得
--创建一个类并使其:(A)定义一个私有的构造器(B)定义一个私有、静态的变量指向自己(C)定义一个公有、静态的访问方法用于返回该类的一个唯一实例
分为 饿汉式 和 懒汉式,下面是一个简单的示例代码,应该 ......
package edu.zzu.jdbc.Test;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import com.ambow.jdbc.entity.Student;
public class TestDBConn{
public static void main(String args[]){
Str ......
如果想让所有用户share:
emacs -nw /etc/profile
然后在未尾加入
#set java environment
set JAVA_HOME=/usr/java/jdk1.5.0_16
set PATH=.:$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME
如果仅当前用户使用:
把上面的加入用户目录下的.bash_profile或.bash-rc
然后运行source /etc/profile生效 ......