国产成人毛片亚洲精品,亚洲国产精品一区二区久,亚洲AV无码一区二区三区网址http://www.tkk7.com/sxyx2008/category/42290.html溫馨提示:您的每一次轉載,體現了我寫此文的意義!!!煩請您在轉載時注明出處http://www.tkk7.com/sxyx2008/謝謝合作!!! zh-cnTue, 02 Apr 2013 13:26:43 GMTTue, 02 Apr 2013 13:26:43 GMT60基于maven的多框架和多視圖融合技術(Struts1、Struts2、Spring、SpringMVC、Hibernate、Ibatis、MyBatis、Spring Data JPA、DWR)http://www.tkk7.com/sxyx2008/archive/2012/09/25/388490.html雪山飛鵠雪山飛鵠Tue, 25 Sep 2012 03:40:00 GMThttp://www.tkk7.com/sxyx2008/archive/2012/09/25/388490.htmlhttp://www.tkk7.com/sxyx2008/comments/388490.htmlhttp://www.tkk7.com/sxyx2008/archive/2012/09/25/388490.html#Feedback0http://www.tkk7.com/sxyx2008/comments/commentRss/388490.htmlhttp://www.tkk7.com/sxyx2008/services/trackbacks/388490.html該項目基于maven3.0構建的,項目中融合了Struts1、Struts2、Spring、SpringMVC、Hibernate、Ibatis、MyBatis、Spring Data JPA、Spring JDBC、Spring DWR。頁面展現這里使用Struts1、Struts2、SpringMVC(jsp視圖、velocity視圖、freemarker視圖、pdf視圖、excel視圖、xml視圖、json視圖等)。是一個綜合性行的項目。該項目后期會陸續集成Spring的一些好的框架進來比如說Spring Web Flow、Spring Security 、Jbpm、WebService、Compass、Solr、nutch等。總之是一個綜合性的項目。該項目不處理業務,主要是把目前自己工作中用到過的各種框架糅合到一個項目中。純粹是一個jee框架的糅合,主要是介紹各種技術。

介紹下目前使用的各個框架的版本信息

Struts1 1.3.10

Struts2 2.3.8

Spring 3.2.0.RELEASE

Hibernate 4.2.0.Final

Ibatis 2.3.4.726

MyBatis 3.1.1

Spring Data JPA 1.3.0.RELEASE

DWR 3.0.M1

項目中的持久化框架sql語句的跟蹤采用了log4jdbc4結合log4j,在控制臺可以看到完整的sql語句。

該項目中使用到的技術均與Spring已集成。除了DWR與Spring集成使用xml文件中配置bean外 其他的bean均使用注解完善。每一個與數據庫有關的都有事務處理。

項目結構圖


項目托管SVN地址:http://maven-framework-project.googlecode.com/svn/trunk/ (限于大陸google code 不穩定,導致經常無法訪問,該地址已不在同步,建議使用github地址)
項目托管GitHub地址:https://github.com/sxyx2008/maven-framework-project/(推薦使用)

最后希望有興趣的朋友可以加入進來,大家一起完善他。把自己的技術分享出來。如有任何問題可以與我聯系

聯系方式

QQ:184675420

Email:sxyx2008@gmail.com



雪山飛鵠 2012-09-25 11:40 發表評論
]]>
使用urlrewrite美化struts請求地址http://www.tkk7.com/sxyx2008/archive/2011/11/24/364706.html雪山飛鵠雪山飛鵠Thu, 24 Nov 2011 03:48:00 GMThttp://www.tkk7.com/sxyx2008/archive/2011/11/24/364706.htmlhttp://www.tkk7.com/sxyx2008/comments/364706.htmlhttp://www.tkk7.com/sxyx2008/archive/2011/11/24/364706.html#Feedback0http://www.tkk7.com/sxyx2008/comments/commentRss/364706.htmlhttp://www.tkk7.com/sxyx2008/services/trackbacks/364706.htmlJAR版本:urlrewrite-3.2.0.jar
web.xml配置
    <filter>
        
<filter-name>UrlRewriteFilter</filter-name>
        
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
        
<init-param>
            
<param-name>confReloadCheckInterval</param-name>
            
<param-value>60</param-value>
        
</init-param>
        
<init-param>
            
<param-name>confPath</param-name>
            
<param-value>/WEB-INF/urlrewrite.xml</param-value>
        
</init-param>
     
</filter>
     
     
<filter-mapping>
         
<filter-name>UrlRewriteFilter</filter-name>
         
<dispatcher>REQUEST</dispatcher>
         
<dispatcher>FORWARD</dispatcher>
         
<url-pattern>/*</url-pattern>
     
</filter-mapping>
urlrewrite.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN"
        "http://tuckey.org/res/dtds/urlrewrite3.2.dtd"
>

<!--

    Configuration file for UrlRewriteFilter
    http://tuckey.org/urlrewrite/

-->
<urlrewrite> 
    
<!-- 
        匹配地址為
        形如/content/94/list的地址將跳轉到
        /IssuedContentAction.do?dispatch=vContentListBySubid&amp;scope=vmcontent&amp;columninfoid=$1
    
-->
    
<rule>
        
<!-- 地址欄顯示的地址 -->
        
<from>/content/([0-9]+)/list</from>  
        
<!-- 真實的請求地址 -->
        
<to type="forward">/IssuedContentAction.do?dispatch=vContentListBySubid&amp;scope=vmcontent&amp;columninfoid=$1</to>
    
</rule>
    
<!--

    INSTALLATION

        in your web.xml add

        <filter>
            <filter-name>UrlRewriteFilter</filter-name>
            <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
            <init-param>
                <param-name>logLevel</param-name>
                <param-value>WARN</param-value>
            </init-param>
        </filter>
        <filter-mapping>
            <filter-name>UrlRewriteFilter</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>

     EXAMPLES

     Redirect one url
        <rule>
            <from>/some/old/page.html</from>
            <to type="redirect">/very/new/page.html</to>
        </rule>

    Redirect a directory
        <rule>
            <from>/some/olddir/(.*)</from>
            <to type="redirect">/very/newdir/$1</to>
        </rule>

    Clean a url
        <rule>
            <from>/products/([0-9]+)</from>
            <to>/products/index.jsp?product_id=$1</to>
        </rule>
    eg, /products/1234 will be passed on to /products/index.jsp?product_id=1234 without the user noticing.

    Browser detection
        <rule>
            <condition name="user-agent">Mozilla/[1-4]</condition>
            <from>/some/page.html</from>
            <to>/some/page-for-old-browsers.html</to>
        </rule>
    eg, will pass the request for /some/page.html on to /some/page-for-old-browsers.html only for older
    browsers whose user agent srtings match Mozilla/1, Mozilla/2, Mozilla/3 or Mozilla/4.

    Centralised browser detection
        <rule>
            <condition name="user-agent">Mozilla/[1-4]</condition>
            <set type="request" name="browser">moz</set>
        </rule>
    eg, all requests will be checked against the condition and if matched
    request.setAttribute("browser", "moz") will be called.

    
-->

</urlrewrite>
注意:
1、多個參數之間的連接符要用&amp;而不是&
2、匹配從應用程序的名稱開始匹配

瀏覽器中顯示的請求地址(請求鏈接中填寫的地址)
/content/91/list
真正的請求地址
/IssuedContentAction.do?dispatch=vContentListBySubid&scope=vmcontent&columninfoid=91




雪山飛鵠 2011-11-24 11:48 發表評論
]]>
Struts2、Spring、Hibernate、Lucene整合Compass實現搜索http://www.tkk7.com/sxyx2008/archive/2011/05/26/351109.html雪山飛鵠雪山飛鵠Thu, 26 May 2011 09:02:00 GMThttp://www.tkk7.com/sxyx2008/archive/2011/05/26/351109.htmlhttp://www.tkk7.com/sxyx2008/comments/351109.htmlhttp://www.tkk7.com/sxyx2008/archive/2011/05/26/351109.html#Feedback1http://www.tkk7.com/sxyx2008/comments/commentRss/351109.htmlhttp://www.tkk7.com/sxyx2008/services/trackbacks/351109.html        花時間嘗試著寫了個Struts2+Spring+Hibernate+Compass+Lucene整合的例子.代碼和jar包較多,有興趣的朋友可以去http://sshcompass.googlecode.com/svn/trunk/將工程撿下來。希望和大家一起探討Compass這個框架。


雪山飛鵠 2011-05-26 17:02 發表評論
]]>
jquery之ajaxfileupload異步上傳插件http://www.tkk7.com/sxyx2008/archive/2010/11/02/336826.html雪山飛鵠雪山飛鵠Tue, 02 Nov 2010 08:57:00 GMThttp://www.tkk7.com/sxyx2008/archive/2010/11/02/336826.htmlhttp://www.tkk7.com/sxyx2008/comments/336826.htmlhttp://www.tkk7.com/sxyx2008/archive/2010/11/02/336826.html#Feedback4http://www.tkk7.com/sxyx2008/comments/commentRss/336826.htmlhttp://www.tkk7.com/sxyx2008/services/trackbacks/336826.html點我下載工程代碼
由于項目需求,在處理文件上傳時需要使用到文件的異步上傳。這里使用Jquery Ajax File Uploader這個組件下載地址http://www.phpletter.com/download_project_version.php?version_id=6
服務器端采用struts2來處理文件上傳。
所需環境:
jquery.js
ajaxfileupload.js
struts2所依賴的jar包
及struts2-json-plugin-2.1.8.1.jar
編寫文件上傳的Action

package com.ajaxfile.action;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings(
"serial")
public class FileAction extends ActionSupport {

    
private File file;
    
private String fileFileName;
    
private String fileFileContentType;

    
private String message = "你已成功上傳文件";
    
    
public String getMessage() {
        
return message;
    }

    
public void setMessage(String message) {
        
this.message = message;
    }

    
public File getFile() {
        
return file;
    }

    
public void setFile(File file) {
        
this.file = file;
    }

    
public String getFileFileName() {
        
return fileFileName;
    }

    
public void setFileFileName(String fileFileName) {
        
this.fileFileName = fileFileName;
    }

    
public String getFileFileContentType() {
        
return fileFileContentType;
    }

    
public void setFileFileContentType(String fileFileContentType) {
        
this.fileFileContentType = fileFileContentType;
    }

    @SuppressWarnings(
"deprecation")
    @Override
    
public String execute() throws Exception {
        
        String path 
= ServletActionContext.getRequest().getRealPath("/upload");

        
try {
            File f 
= this.getFile();
            
if(this.getFileFileName().endsWith(".exe")){
                message
="對不起,你上傳的文件格式不允許!!!";
                
return ERROR;
            }
            FileInputStream inputStream 
= new FileInputStream(f);
            FileOutputStream outputStream 
= new FileOutputStream(path + "/"+ this.getFileFileName());
            
byte[] buf = new byte[1024];
            
int length = 0;
            
while ((length = inputStream.read(buf)) != -1) {
                outputStream.write(buf, 
0, length);
            }
            inputStream.close();
            outputStream.flush();
        } 
catch (Exception e) {
            e.printStackTrace();
            message 
= "對不起,文件上傳失敗了!!!!";
        }
        
return SUCCESS;
    }

}
struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
    
<package name="struts2" extends="json-default">
        
<action name="fileUploadAction" class="com.ajaxfile.action.FileAction">
            
<result type="json" name="success">
                
<param name="contentType">
                    text/html
                
</param>
            
</result>
            
<result type="json" name="error">
                
<param name="contentType">
                    text/html
                
</param>
            
</result>
        
</action>
    
</package>
</struts>    
注意結合Action觀察struts.xml中result的配置。 

contentType參數是一定要有的,否則瀏覽器總是提示將返回的JSON結果另存為文件,不會交給ajaxfileupload處理。這是因為struts2 JSON Plugin默認的contentType為application/json,而ajaxfileupload則要求為text/html。
文件上傳的jsp頁面

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding
="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    
<head>
        
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        
<title>Insert title here</title>
        
<script type="text/javascript" src="js/jquery.js"></script>
        
<script type="text/javascript" src="js/ajaxfileupload.js"></script>
        
<script type="text/javascript">
    
function ajaxFileUpload()
    {
        
        $(
"#loading")
        .ajaxStart(
function(){
            $(
this).show();
        })
//開始上傳文件時顯示一個圖片
        .ajaxComplete(function(){
            $(
this).hide();
        });
//文件上傳完成將圖片隱藏起來
        
        $.ajaxFileUpload
        (
            {
                url:'fileUploadAction.action',
//用于文件上傳的服務器端請求地址
                secureuri:false,//一般設置為false
                fileElementId:'file',//文件上傳空間的id屬性  <input type="file" id="file" name="file" />
                dataType: 'json',//返回值類型 一般設置為json
                success: function (data, status)  //服務器成功響應處理函數
                {
                    alert(data.message);
//從服務器返回的json中取出message中的數據,其中message為在struts2中action中定義的成員變量
                    
                    
if(typeof(data.error) != 'undefined')
                    {
                        
if(data.error != '')
                        {
                            alert(data.error);
                        }
else
                        {
                            alert(data.message);
                        }
                    }
                },
                error: 
function (data, status, e)//服務器響應失敗處理函數
                {
                    alert(e);
                }
            }
        )
        
        
return false;

    }
    
</script>
    
</head>
    
<body>
        
<img src="loading.gif" id="loading" style="display: none;">
        
<input type="file" id="file" name="file" />
        
<br />
        
<input type="button" value="上傳" onclick="return ajaxFileUpload();">
    
</body>
</html>

 注意觀察<body>中的代碼,并沒有form表單。只是在按鈕點擊的時候觸發ajaxFileUpload()方法。需要注意的是js文件引入的先后順序,ajaxfileupload.js依賴于jquery因此你知道的。
點我下載工程代碼



雪山飛鵠 2010-11-02 16:57 發表評論
]]>
標簽大全http://www.tkk7.com/sxyx2008/archive/2010/07/28/327276.html雪山飛鵠雪山飛鵠Wed, 28 Jul 2010 00:45:00 GMThttp://www.tkk7.com/sxyx2008/archive/2010/07/28/327276.htmlhttp://www.tkk7.com/sxyx2008/comments/327276.htmlhttp://www.tkk7.com/sxyx2008/archive/2010/07/28/327276.html#Feedback0http://www.tkk7.com/sxyx2008/comments/commentRss/327276.htmlhttp://www.tkk7.com/sxyx2008/services/trackbacks/327276.htmlhttp://www.web-tag.net/index.htm,仔細一看還很全的。正是我所需要的,不敢獨享,拿出來跟大家分享下。
        網址:http://www.web-tag.net/index.htm
        

雪山飛鵠 2010-07-28 08:45 發表評論
]]>
Struts2自定義類型轉換http://www.tkk7.com/sxyx2008/archive/2010/01/12/309151.html雪山飛鵠雪山飛鵠Tue, 12 Jan 2010 06:37:00 GMThttp://www.tkk7.com/sxyx2008/archive/2010/01/12/309151.htmlhttp://www.tkk7.com/sxyx2008/comments/309151.htmlhttp://www.tkk7.com/sxyx2008/archive/2010/01/12/309151.html#Feedback6http://www.tkk7.com/sxyx2008/comments/commentRss/309151.htmlhttp://www.tkk7.com/sxyx2008/services/trackbacks/309151.html閱讀全文

雪山飛鵠 2010-01-12 14:37 發表評論
]]>
struts2驗證框架校驗http://www.tkk7.com/sxyx2008/archive/2009/10/23/299512.html雪山飛鵠雪山飛鵠Fri, 23 Oct 2009 09:42:00 GMThttp://www.tkk7.com/sxyx2008/archive/2009/10/23/299512.htmlhttp://www.tkk7.com/sxyx2008/comments/299512.htmlhttp://www.tkk7.com/sxyx2008/archive/2009/10/23/299512.html#Feedback3http://www.tkk7.com/sxyx2008/comments/commentRss/299512.htmlhttp://www.tkk7.com/sxyx2008/services/trackbacks/299512.html       鑒于此文圖片丟失,影響閱讀質量,特上傳此博文word文檔,廣大網友可點此下載word文檔

呵呵,最近一直在看struts2方面的資料。大家都知道web開發過程中,我們經常要處理客戶端(用戶)提交過來的數據(增加記錄)及后臺數據庫查詢出來的數據(修改記錄),這里難免會出現一些不符合要求的數據,我們稱為“臟數據”。這里就借助于struts2提供的驗證框架來做數據的驗證(其實它依賴的還是webwork)

在使用struts2或者說webwork的驗證框架時必須遵守以下幾點:

在這里不要管為什么,人家就是這么約定的,我們只要照做就是了。除非你是科研人員,如果僅僅是項目需要,建議大家還是不要在這上面花過多的時間,不值得。

在對應的Action的包下(必須跟該Action在同一個目錄)創建驗證框架規則(.xml文件)

xml文件的命名必須遵守如下規則:

1)         該文件必須跟該對應的Action在同一個目錄

2)         Action的名字---對應Action中的方法名(execute方法除外)-validation.xml

如:

如圖所示該文件名由三部分組成:

第一部分:Action的類名

第二部分:Action中的方法名

第三部分:validation.xml(固定)

         這三部分之間用橫線連接-

         驗證規則(EmployeeAction-updateEmployee-validation.xml)內容

         因為Action是基于模型驅動的即在Action引用了對象模型,所以在寫驗證規則的時候字段屬性為Action中對象模型名.具體的屬性()

Action中的引用關系

EmployeeAction-updateEmployee-validation.xml中的配置內容

詳細參看EmployeeAction-updateEmployee-validation.xml中的配置

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE validators PUBLIC

       "-//OpenSymphony Group//XWork Validator 1.0.2//EN"

       "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">

       <validators>

           <field name="employee.empName">

               <field-validator type="requiredstring">

                   <message>雇員姓名不能為空</message>

               </field-validator>

           </field>

             <field name="employee.age">

               <field-validator type="required">

                   <message>雇員年齡不能為空</message>

               </field-validator>

           </field>

          <field name="employee.sex">

               <field-validator type="requiredstring">

                   <message>雇員性別不能為空</message>

               </field-validator>

           </field>

           <field name="employee.context">

               <field-validator type="requiredstring">

                   <message>雇員備注信息不能為空</message>

               </field-validator>

           </field>

       </validators>

<field name="驗證字段(Action中對象模型名字.具體的屬性)">

               <field-validator type="requiredstring">   驗證規則

                   <message>驗證出錯信息</message>

               </field-validator>

</field>

最后千萬別忘了在struts.xml文件中一定要配置一個結果為input的轉向

否則驗證失敗時會出現如下錯誤:


鑒于此文圖片丟失,影響閱讀質量,特上傳此博文word文檔,廣大網友可點此下載word文檔



雪山飛鵠 2009-10-23 17:42 發表評論
]]>
Struts2文件上傳http://www.tkk7.com/sxyx2008/archive/2009/10/22/299285.html雪山飛鵠雪山飛鵠Thu, 22 Oct 2009 01:35:00 GMThttp://www.tkk7.com/sxyx2008/archive/2009/10/22/299285.htmlhttp://www.tkk7.com/sxyx2008/comments/299285.htmlhttp://www.tkk7.com/sxyx2008/archive/2009/10/22/299285.html#Feedback3http://www.tkk7.com/sxyx2008/comments/commentRss/299285.htmlhttp://www.tkk7.com/sxyx2008/services/trackbacks/299285.html閱讀全文

雪山飛鵠 2009-10-22 09:35 發表評論
]]>
Struts2文件上傳一些小細節http://www.tkk7.com/sxyx2008/archive/2009/10/21/299157.html雪山飛鵠雪山飛鵠Wed, 21 Oct 2009 02:33:00 GMThttp://www.tkk7.com/sxyx2008/archive/2009/10/21/299157.htmlhttp://www.tkk7.com/sxyx2008/comments/299157.htmlhttp://www.tkk7.com/sxyx2008/archive/2009/10/21/299157.html#Feedback0http://www.tkk7.com/sxyx2008/comments/commentRss/299157.htmlhttp://www.tkk7.com/sxyx2008/services/trackbacks/299157.html閱讀全文

雪山飛鵠 2009-10-21 10:33 發表評論
]]>
struts2整合spring Action注意事項http://www.tkk7.com/sxyx2008/archive/2009/10/20/299065.html雪山飛鵠雪山飛鵠Tue, 20 Oct 2009 08:54:00 GMThttp://www.tkk7.com/sxyx2008/archive/2009/10/20/299065.htmlhttp://www.tkk7.com/sxyx2008/comments/299065.htmlhttp://www.tkk7.com/sxyx2008/archive/2009/10/20/299065.html#Feedback0http://www.tkk7.com/sxyx2008/comments/commentRss/299065.htmlhttp://www.tkk7.com/sxyx2008/services/trackbacks/299065.html 注意要設置,action bean 的 scope 的值。因為spring的bean默認為單實例singleton,故一定要設scope的值但不能為singleton。建議設置為prototype或request

雪山飛鵠 2009-10-20 16:54 發表評論
]]>
struts2取值http://www.tkk7.com/sxyx2008/archive/2009/10/19/298842.html雪山飛鵠雪山飛鵠Mon, 19 Oct 2009 06:16:00 GMThttp://www.tkk7.com/sxyx2008/archive/2009/10/19/298842.htmlhttp://www.tkk7.com/sxyx2008/comments/298842.htmlhttp://www.tkk7.com/sxyx2008/archive/2009/10/19/298842.html#Feedback0http://www.tkk7.com/sxyx2008/comments/commentRss/298842.htmlhttp://www.tkk7.com/sxyx2008/services/trackbacks/298842.html
當Action的valueStack中有該屬性的值時,只需直接使用該屬性的名字即可;

當Action的valueStack中沒有該屬性的值時,比如在session,application范圍中的屬性值時,需要加#或者#attr.;

例子:
假設某Action中有person成員變量,在application中存在company屬性
那么我們可以通過以下方法取值:
<s:property value="person.name" />
<s:property value="#person.name" />
<s:property value="company.name" /> //無法取到,因為company不在action的valueStack中
<s:property value="#company.name" />

<s:textfield name="person.name" value="person.name" /> //錯誤,value會直接顯示person.name字樣
<s:textfield name="person.name" value="%{person.name}" />
<s:textfield name="person.company.name" value="%{#company.name}" />
<s:textfield name="person.company.name" value="%{#attr.company.name}" />

雪山飛鵠 2009-10-19 14:16 發表評論
]]>
struts2亂碼http://www.tkk7.com/sxyx2008/archive/2009/10/19/298841.html雪山飛鵠雪山飛鵠Mon, 19 Oct 2009 06:08:00 GMThttp://www.tkk7.com/sxyx2008/archive/2009/10/19/298841.htmlhttp://www.tkk7.com/sxyx2008/comments/298841.htmlhttp://www.tkk7.com/sxyx2008/archive/2009/10/19/298841.html#Feedback0http://www.tkk7.com/sxyx2008/comments/commentRss/298841.htmlhttp://www.tkk7.com/sxyx2008/services/trackbacks/298841.html最近學習struts2是一個問題接著一個問題的遇到

剛解決了java.lang.IllegalArgumentException: attempt to create saveOrUpdate event with null entity

接著就來最討厭的亂碼問題,我數據庫用的mysql,大家都知道mysql本省就有可能出現亂碼,加之現在跟struts2混合在一起,指不定會出現什么亂七八糟的編碼,這誰也說不清楚

整體思路那就是統一編碼(所有的內容都采用同一個編碼)

大概從這幾個方面來排查

a)         首先確認mysql的字符編碼,他默認為拉丁文,這里我修改為gbk

b)        jsp頁面中明確指明編碼類型

<%@ page language="java" contentType="text/html; charset=gbk"

pageEncoding="gbk"%>

上面的意思是指定tomcat的編碼為gbk

<meta http-equiv="Content-Type" content="text/html; charset=gbk">

    下面的意思是指定web瀏覽器的編碼為gbk

c)        習慣性的加上spring的字符過濾器

web.xml中添加過濾器

<filter>

        <filter-name>CharacterEncodingFilter</filter-name>

    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>

        <init-param>

            <param-name>encoding</param-name>

            <param-value>gbk</param-value>

        </init-param>

        <init-param>

            <param-name>forceEncoding</param-name>

            <param-value>true</param-value>

        </init-param>

    </filter>

    <filter-mapping>

        <filter-name>CharacterEncodingFilter</filter-name>

        <url-pattern>/*</url-pattern>

    </filter-mapping>

d)        最后別忘了在struts.xmlstruts.properties中覆蓋struts2默認國際化的編碼格式

<constant name="struts.i18n.encoding" value="gbk"></constant>

到此編碼應該已經統一為gbk了,看看結果吧

其實最簡單的放法就是把數據庫和jsp中的編碼統一設置為utf-8即可



雪山飛鵠 2009-10-19 14:08 發表評論
]]>
主站蜘蛛池模板: 国产无遮挡裸体免费视频| 久久亚洲精品11p| 亚洲最大AV网站在线观看| 野花高清在线观看免费完整版中文| 一级一片免费视频播放| 亚洲色欲色欱wwW在线| 亚洲国产成人一区二区三区| 亚洲AV蜜桃永久无码精品| 免费在线观看的网站| aⅴ免费在线观看| 免费成人高清在线视频| 国产A∨免费精品视频| 美女视频黄频a免费| 亚洲国产精品无码久久久秋霞1| 亚洲大片免费观看| 亚洲精品线在线观看| 亚洲精品乱码久久久久久中文字幕| 亚洲AV无码不卡在线观看下载| 白白国产永久免费视频| 国内免费高清在线观看| 亚洲一区二区三区免费观看| 99久久99久久免费精品小说| 免费黄网站在线看| 十八禁在线观看视频播放免费| 一级中文字幕乱码免费| 永久免费无码网站在线观看个| 另类专区另类专区亚洲| 粉色视频免费入口| 黄人成a动漫片免费网站| 国产亚洲精品美女久久久久| 羞羞视频免费网站入口| 日韩大片免费观看视频播放| 污污的视频在线免费观看| 边摸边脱吃奶边高潮视频免费| 美景之屋4在线未删减免费| 免费手机在线看片| 尤物视频在线免费观看| 国产成人1024精品免费| 免费成人在线视频观看| 99久久精品国产免费| 青青青免费国产在线视频小草|