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ѧϰ´ÓÈëÃŵ½¾«Í¨
Ò»¡¢ JDK (Java Development Kit)
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......
1£©&£ºÓëÔËË㣬½«Á½¸öÊý·Ö±ðת»¯³É²¹Â룬Ȼºó½øÐÐÔËË㣨ȫ1µÃ1£¬ÓÐ0³ö0£©¡£
2£©£¡£º·ÇÔËË㣬½«Êý×Ö×ÔÉíÈ¡·´£¨×ª»¯³É²¹Â룬°´Î»È¡·´——1±ä0£¬0±ä1£©¡£
3£©<<£º×óÒÆÔËËã·û£¬½«Ä³¸öÊ®½øÖÆ×ª»»³É¶þ½øÖÆÖ®ºóĩβµÄn¸ö¶þ½øÖÆÊýÒÔ´ËÍù×óÒÆ¶¯£¬Òç³öµÄnλÓÃ0ÔÚĩβ²¹×ã¡£
4£©>>£º´ø·ûºÅÓÒÒÆÔË ......
//¼òµ¥µÄjavaÈÕÆÚ¸ñʽ¿ØÖÆ
java.Text.SimpleDateFormat format = new java.Text.SimpleDateFormat("yyyy-MM-dd hh:mm:ss");//ÄãÏëÒªµÄ¸ñʽ
//×¢ÒâÔµÄλÖÃÒª´óдµÄMM Òª²»¾Í¿´µ½µÄ²»ÊÇÕýÈ·ÏÔʾ£¬¿ÉÒÔ°ÑÄãÏëҪת»»µÄÈÕÆÚת»»ÎªÏàÓ¦µÄ¸ñʽ°¡
format.format(new java.util.Date());//dateΪÈÕÆÚÐÍÊý¾Ý£¬¿ÉÒÔÈÎÒ ......
String startTime, String endTime;
Date start = null;
Date end = null;
Date startTimeStamp = null;
Date endTimeStamp = null;
try {
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
......
javaÖи¡µãÊýµÄ¼ÆËã
½ñÌìÔÚÊýÖµ¼ÆËãʱÅöµ½Ò»¸öÎÊÌâ.³ÌÐòÈçÏÂ:
double a = (3.3-2.4)/0.1;
System.out.println(a);
Äã¿ÉÄÜÈÏΪ½á¹ûºÜ¼òµ¥,²»¾ÍÊÇ9Âï,ÊÇÊÂʵÉÏ,½á¹ûΪ:8.999999998,ÎªÊ²Ã´ÄØ?ÎÒ·ÔÄÁËһЩ×ÊÁÏ,ÖÕÓÚÕÒ³öÁËÔÒò.
Ϊʲô¸¡µãÊý»á¶ªÊ§¾«¶È£¿
Ê®½øÖÆÊýµÄ¶þ½øÖƱíʾ¿ÉÄܲ»¹»¾«È·
......