<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 61,  comments - 2033,  trackbacks - 0
    剛剛碰到的問題—— <html:text name="userForm" property="user.userAccount" styleClass="myInput" readOnly="true" /> 有錯(cuò)嗎? 暈哦,就是錯(cuò)了,得把readOnly="true"改為readonly="true",可是在javasript下,用函數(shù)去指定true或者false,O就必須大寫…… 所以就去找了以下一篇。

    轉(zhuǎn)自: 落葉空嘆飄花翎 http://www.itpub.net/336395,1.html

    Java 開發(fā)中遇到的亂碼問題

    若想明白jsp開發(fā)過程中為什么會(huì)產(chǎn)生中文亂碼,我們先來看看unicode編碼。
    Unicode (統(tǒng)一碼)顧名思義是一個(gè)將世界上各種文字統(tǒng)一在一起的東東。由美國各大電腦廠商組成的Unicode策進(jìn)會(huì)來推動(dòng)。目的,推廣一個(gè)世界通用的編碼體制,驚世界上所有常用的文字都涵蓋進(jìn)去,從而減少個(gè)電腦商開發(fā)國外市場(chǎng)遇到的問題。
    為了將成千上萬的文字統(tǒng)統(tǒng)收集到一個(gè)共同的編碼機(jī)制下,在兼顧經(jīng)濟(jì)的原則下,不管是東方還是西方文字,每個(gè)字在Unicode中一律以兩個(gè)Bytes來表示,這樣至少有2的16次方65536種不同的組合,足以應(yīng)付目前絕大多數(shù)場(chǎng)合的需要。
    基本上,計(jì)算機(jī)只是處理數(shù)字。它們指定一個(gè)數(shù)字,來儲(chǔ)存字母或其他字符。在創(chuàng)造Unicode之前,有數(shù)百種指定這些數(shù)字的編碼系統(tǒng)。沒有一個(gè)編碼可以包含足夠的字符:例如,單單歐州共同體就需要好幾種不同的編碼來包括所有的語言。即使是單一種語言,例如英語,也沒有哪一個(gè)編碼可以適用于所有的字母,標(biāo)點(diǎn)符號(hào),和常用的技術(shù)符號(hào)。
    這些編碼系統(tǒng)也會(huì)互相沖突。也就是說,兩種編碼可能使用相同的數(shù)字代表兩個(gè)不同的字符,或使用不同的數(shù)字代表相同的字符。任何一臺(tái)特定的計(jì)算機(jī)(特別是服務(wù)器)都需要支持許多不同的編碼,但是,不論什么時(shí)候數(shù)據(jù)通過不同的編碼或平臺(tái)之間,那些數(shù)據(jù)總會(huì)有損壞的危險(xiǎn)。
    Unicode給每個(gè)字符提供了一個(gè)唯一的數(shù)字,不論是什么平臺(tái),不論是什么程序,不論什么語言。Unicode標(biāo)準(zhǔn)已經(jīng)被這些工業(yè)界的領(lǐng)導(dǎo)們所采用,例如:Apple, HP, IBM, JustSystem, Microsoft, Oracle, SAP, Sun, Sybase, Unisys和其它許多公司。最新的標(biāo)準(zhǔn)都需要Unicode,例如XML, Java, ECMAScript (JavaScript), LDAP, CORBA 3.0, WML等等,并且,Unicode是實(shí)現(xiàn)ISO/IEC 10646的正規(guī)方式。許多操作系統(tǒng),所有最新的瀏覽器和許多其他產(chǎn)品都支持它。Unicode標(biāo)準(zhǔn)的出現(xiàn)和支持它工具的存在,是近來全球軟件技術(shù)最重要的發(fā)展趨勢(shì)。
    將Unicode與客戶服務(wù)器或多層應(yīng)用程序和網(wǎng)站結(jié)合,比使用傳統(tǒng)字符集節(jié)省費(fèi)用。Unicode使單一軟件產(chǎn)品或單一網(wǎng)站能夠貫穿多個(gè)平臺(tái),語言和國家,而不需要重建。它可將數(shù)據(jù)傳輸?shù)皆S多不同的系統(tǒng),而無損壞。
    在與Unicode相關(guān)的各技術(shù)文件中,經(jīng)常會(huì)看到ISO 10646和UCS這兩個(gè)名詞。
    ISO是位于瑞士的國際標(biāo)準(zhǔn)局的縮寫。
    UCS為ISO頒布的第10646號(hào)標(biāo)準(zhǔn) Universal Character Set,就是世界通用字符集。
    UCS通用字符集采用4個(gè)Bytes來編碼,將世界上所有的官用和商用編碼大小通吃,一網(wǎng)打盡。Unicode自1991年便和ISO的UCS小組密切配合,讓Unicode和ISO 10646保持一致。因此Unicode 自2.0版開始,便和 ISO 10646-1使用相同的編碼。
    康熙字典中的漢字有4萬7千,如果再加上里面沒有的簡(jiǎn)體字,和不同寫法的日文字,那么 Unicode6萬多的分配空間,光用來分配漢字就顯得捉禁見晝,更別說什么泰文,阿拉伯等其他文字了。針對(duì)這個(gè)問題Unicode和UCS采用了[中日韓文整合](CJK Unification)的解決方案,把中日韓筆畫詳盡的漢字用同一個(gè)單碼表示。
    經(jīng)過[中日韓文整合]的Unicode稱為統(tǒng)漢字Unihan。
    完整的Unicode4.0版可由http://www.unicode.org/Public/UNIDATA/Unihan.txt 下載。

    UTF (Unicode/UCS Transformation Format),Unicode推薦使用UTF-8和UTF-16兩種格式其中8和16指的是Bits數(shù)而不是Bytes數(shù)。
    UTF-16基本就是Unicode雙字節(jié)的實(shí)現(xiàn),加上一個(gè)應(yīng)付未來需要的擴(kuò)充編碼機(jī)制(很少用)
    UTF-8 是一種不等幅的編碼方式,英數(shù)字(Ascii字碼)保持原狀,完全不受影響(因此不需要做轉(zhuǎn)換),而其他漢字資料須透過程序來轉(zhuǎn)換,會(huì)[變胖],因?yàn)槊總€(gè)字需要額外一個(gè)或兩個(gè)Bytes來編碼。
    UCS字符集中,有UCS-2和UCS-4等編碼方式其中的2和4指的是bytes數(shù),對(duì)應(yīng)UTF-8和UTF-16.
    UCS-2基本和Unicode雙byte 編碼差不多
    UCS-4四 byte編碼表示一個(gè)字,在每個(gè) UCS-2前面加上兩個(gè)空白的Byte,便可得到對(duì)應(yīng)的 UCS-4。

    Unicode的空間分配:
    以下Unicode區(qū)位碼均以16進(jìn)制表示
    Unicode的前256個(gè)字符和ISO-8859-1(西歐字母)完全相同,其中前半段就是Ascii(u+0000到u+00FF)。每個(gè)ISO-8859-1碼前面補(bǔ)上一個(gè)空byte(0x00)后才是相應(yīng)的Unicode碼。
    和我們切身相關(guān)的Unihan主要分布在u+3400到u+F9FFF之間,GB2312和BIG5主要分布在u+4E00到U+9FFF之間。

    UTF-8的編碼原理和特性:
    知道了西歐字符和漢字在Unicode中的位置后,來看看UTF-8

    U+0000~U+007E 1 _ _ _ _ _ _ _ (7bits)
    U+0080~U+07FF 1 1 0_ _ _ _ _ 1 0_ _ _ _ _ _ (11bits)
    U+0800~U+FFFF 1 1 1 0 _ _ _ _ 1 0 _ _ _ _ _ _ 1 0 _ _ _ _ _ _ (16bits)
    看一看Unicode三種格式提出自由的bits(下劃線空位)是否足以用來代表區(qū)位中各Unicode碼,剛好夠用。
    那么當(dāng)程序處理UTF-8編碼文件時(shí),如何得知一個(gè)字符的疆界落在哪里?還有到底他是以三種形式那一中出現(xiàn)呢?
    每個(gè)以UTF-8編碼的字符,不管是以一、二、三個(gè)bytes出現(xiàn),第一個(gè)byte前端都清楚地標(biāo)示了該字符的byte總數(shù)。如110種有兩個(gè)1,代表這種字符是以第二種方式出現(xiàn),由兩個(gè)bytes組成。而1110有三個(gè)1,表示這種字符一點(diǎn)種方式出現(xiàn),由三個(gè)字節(jié)組成。
    每個(gè)多重byte的UTF-8編碼有一個(gè)共同的通性,即其中的第二個(gè)第三個(gè)byte, 一律以10兩個(gè)bits開頭。由于其中的最高位總設(shè)成1,可以很容易和那些在UTF-8中只用一個(gè)Byte的ASCII字元區(qū)分開來,方便偵錯(cuò)。
    因?yàn)樯鲜鲈O(shè)計(jì)特點(diǎn),UTF-8和Unicode之間,可以很容易做雙向自由轉(zhuǎn)換,而不會(huì)丟失任何資料。

    解決辦法:亂碼問題在 NT操作系統(tǒng)我沒怎么碰到過,但是在UNIX 或LINUX系統(tǒng)上出現(xiàn)的比較多
    由于操作系統(tǒng)和使用環(huán)境不一樣,產(chǎn)生亂碼的方式也不一樣,但是如果掌握了上面的Unicode 編碼原理,自己仔細(xì)分析一下,很多問題便可迎刃而解。
    下面看看幾個(gè)常見的例子。
    1. 如果一些網(wǎng)站服務(wù)器例如Tomcat 如果遇到中文亂碼問題,可以修改conf目錄下的server.xml
    <Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
    enableLookups="false" redirectPort="8443" acceptCount="100" debug="0"connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="GBK"/>
    URIENcoding 設(shè)成GBK或GB2312
    2. 表單中或傳遞字符串:本來輸入的漢字是正常的,但是提交后再顯示出來是亂碼,因?yàn)樘峤坏囊话闶?ISO8859編碼,所以顯示的時(shí)候要轉(zhuǎn)成GB2312編碼:

    String S=new String(rs.getString("news").getBytes("gb2312"),"ISO8859_1");
    //rs為待轉(zhuǎn)換的字符串
    然后使用S字符串的值就可以了
    3. 有的服務(wù)器端的語言環(huán)境如果設(shè)成簡(jiǎn)體中文的也可以解決此類問題
    4. 插入數(shù)據(jù)庫中的字符是亂碼
    看看數(shù)據(jù)庫中支持的是何種編碼方式,用類似2中的方式作一下轉(zhuǎn)換即可。
    5. 總之,用jsp開發(fā),碰到亂碼,你得分析是讀的時(shí)候發(fā)生亂碼,還是寫的時(shí)候發(fā)生亂碼,用2中的轉(zhuǎn)換,基本就能解決問題,有些時(shí)候?qū)懙臅r(shí)候做一次轉(zhuǎn)換,例如:
    String S=new String(rs.getString("news").getBytes("gb2312"),"ISO8859_1");
    //讀的時(shí)候在轉(zhuǎn)換回來
    String S=new String(rs.getString("news").getBytes("ISO8859_1"),"GB2312");
    或者把ISO8859-1和GB2312 的位置換一下,自己多試試,就能找到解決問題的辦法。

    Java_struts 入門快速手冊(cè)

    ----by omencathay
    Struts
    簡(jiǎn)介
    1、 Struts基于MVC模式 Model(Bean) ,View(jsp文件), Control (Action類,ActionForm類)
    2、 開發(fā)準(zhǔn)備
    struts http://jakarta.apache.org/struts
    jdk1.2版本以上 http://java.sun.com/j2se
    Xerces XML parser http://xml.apache.org/xerces-j
    下載struts后,解壓zip文件到一個(gè)臨時(shí)目錄;然后拷貝struts.jar, jakarta-oro.jar, jdbc2_0-stdext.jar和common*.jar文件到你所應(yīng)用struts的WEB-INF/lib目錄下;拷貝struts*.tld文件和*.dtd文件到WEB-INF目錄下,確定該才提到的所有的jar包都在web應(yīng)用服務(wù)器的 classpath環(huán)境變量上設(shè)置。
    3、 配置 (兩個(gè)xml文件:web.xml, struts-config.xml)
    配置web.xml,第一件事情就是注冊(cè)組件action servlet,<servlet> .. </servlet>標(biāo)簽封裝了整個(gè)struts 框架的應(yīng)用程序
    <!-- Action Servlet Configuration -->
    1 <servlet>
    2 <servlet-name>action</servlet-name>
    3 <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    4 <init-param>
    5 <param-name>application</param-name>
    6 <param-value>myApp.properties.ApplicationResources</param-value>
    7 </init-param>
    8 <init-param>
    9 <param-name>config</param-name>
    10 <param-value>/WEB-INF/struts-config.xml</param-value>
    11 </init-param>
    12 </servlet>
    13 <!-- Action Servlet Mapping -->
    14 <servlet-mapping>
    15 <servlet-name>action</servlet-name>
    16 <url-pattern>*.do</url-pattern>
    17 </servlet-mapping>
    18 <!-- Application Tag Library Descriptor -->
    19 <taglib>
    20 <taglib-uri>/WEB-INF/lib/app.tld</taglib-uri>
    21 <taglib-location>/WEB-INF/lib/app.tld</taglib-location>
    22 </taglib>
    23 <!-- Struts Tag Library Descriptor -->
    24 <taglib>
    25 <taglib-uri>/WEB-INF/lib/struts.tld</taglib-uri>
    26 <taglib-location>/WEB-INF/lib/struts.tld</taglib-location>
    27 </taglib>
    28 <!-- Struts Tag Library Descriptors -->
    29 <taglib>
    30 <taglib-uri>/WEB-INF/lib/struts-bean.tld</taglib-uri>
    31 <taglib-location>/WEB-INF/lib/struts-bean.tld</taglib-location>
    32 </taglib>
    33 <taglib>
    34 <taglib-uri>/WEB-INF/lib/struts-form.tld</taglib-uri>
    35 <taglib-location>/WEB-INF/lib/struts-form.tld</taglib-location>
    36 </taglib>
    37 <taglib>
    38 <taglib-uri>/WEB-INF/lib/struts-logic.tld</taglib-uri>
    39 <taglib-location>/WEB-INF/lib/struts-logic.tld</taglib-location>
    40 </taglib>
    41 <taglib>
    42 <taglib-uri>/WEB-INF/lib/struts-template.tld</taglib-uri>
    43 <taglib-location>/WEB-INF/lib/struts-template.tld</taglib-location>
    44 </taglib>

    struts-config.xml文件
    1 <?xml version="1.0" encoding="ISO-8859-1" ?>
    2 <!DOCTYPE struts-config PUBLIC
    3 "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
    4 "5 <struts-config>
    6 <data-sources>
    7 <data-source key = "myDatabase">
    8 <set-property property="autoCommit" value="false"/>
    9
    10 <set-property property="description"
    11 value=" Login Validation Database"/>
    12 <set-property property="driverClass"
    13 value="org.postgresql.Driver"/>
    14 <set-property property="maxCount"
    15 value="4"/>
    16 <set-property property="minCount"
    17 value="2"/>
    18 <set-property property="user"
    19 value="myusername"/>
    20 <set-property property="password"
    21 value="mypassword"/>
    22 <set-property property="url" value="jdbcostgresql://localhost/myAppDatabase"/>
    23
    24 </data-source>
    25 </data-sources>
    26 <!-- ========== Form Bean Definitions ========================== -->
    27 <form-beans>
    28 <!-- Logon form bean -->
    29 <form-bean name="login"
    30 type="myApp.FormBeans.LoginForm"/>
    31 <!-- Order List -->
    32 <form-bean name="orderlist"
    33 type="myApp.FormBeans.OrderForm"/>
    34 </form-beans>
    35 <!-- ========== Global Forward Definitions ===================== -->
    36 <global-forwards>
    37 <forward name="login" path="/login.jsp"/>
    38 </global-forwards>
    39 <!-- ========== Action Mapping Definitions ===================== -->
    40 <action-mappings>
    41 <!-- Process a user logon -->
    42 <action path="/login"
    43 type="myApp.action.LoginExec"
    44 name="login"
    45 validate = "true"
    46 scope="session"
    47 input="/login.jsp">
    48 <forward name="success" path="/secondpage.jsp"/>
    49 <forward name="listorder" path="/orderlistentry.do"/>
    50 <forward name="killSession" path="/SystemError.html"/>
    51 </action>
    52 <!-- Process a user logoff -->
    53 <action path="/logout"
    54 type="myApp.action.LogoutExec">
    55 <forward name="success" path="/logout.jsp"/>
    56 </action>
    57 <!-- Process an order list -->
    58 <action path="/orderlistentry"
    59 type="myApp.action.OrderListExec"
    60 name="orderlist"
    61 scope="session"
    62 input="/orderlistentry.jsp">
    63 <forward name="success" path="/orderlistdisp.jsp"/>
    64 <forward name="killSession" path="/SystemError.html"/>
    65 <forward name="loginAgain" path="/login.jsp"/>
    66 <forward name="selectSalesArea" path="/salesAreas.jsp"/>
    67 </action>
    68 </action-mappings>
    69 </struts-config>

    注:最重要的部分是action-mappings 部分
    <action-mappings>
    每個(gè)<action>元素定義了特定的功能與相關(guān)聯(lián)的動(dòng)作類, 大多數(shù)action元素至少包括以下三個(gè)部分。
    Path-----應(yīng)用程序映射的路徑
    Type-----需要的完整的包和類
    Name-----action應(yīng)用的<form-bean>元素的名稱

    <forward>標(biāo)簽告訴struts框架將要跳轉(zhuǎn)到哪個(gè)jsp頁面;
    <data-sources>標(biāo)簽給出數(shù)據(jù)源屬性;


    4、 struts核心標(biāo)簽庫示例
    1. Html:form
    屬性:onsubmit

    onsubmit屬性得到的是:表單提交時(shí)的javaScript事件句柄
    用法:
    (1).
    Onsubmit 和 html:submit配合使用,javaScript函數(shù)返回true或false

    <html:form action=”” onsubmit=”return javaScriptFunction();”>

    <html:submit onclick=” javaScriptFunction();”/>
    配合使用
    在javaScriptFunction(){
    }中加入return true和return false
    html:from 根據(jù)返回的true或者false決定是否提交
    等同于
    (2)。
    使用Html:button 要在javaScript函數(shù)中加入form.submit();
    <html:form action=””>
    <html:button onclick=” javaScriptFunction();”/>
    form.submit();決定表單的提交

    2. Html:text
    Html:text是輸入框,可以修改數(shù)據(jù)做為property的值


    如果要修改的屬性在bean中有g(shù)et\set方法,可以寫為
    <html:text name="listInfoFormBean" property="invoiceCode"/>

    如果要修改的屬性在某一個(gè)VO里,在VO里對(duì)這一屬性有g(shù)et\set方法,在bean里對(duì)這一VO有g(shù)et\set方法,可以寫為:
    <html:text name="listInfoFormBean" property="tbInvStoresVO.invoiceCode"/>

    3. Bean:write
    Bean:write與html:text用法相似。只是bean:write輸出的數(shù)據(jù)是readonly的

    這一點(diǎn)可以在html:text中加入屬性 readonly=”true”來實(shí)現(xiàn)

    4. Html:select
    <html:select property="invoicePurchaseCode" name=”beanname”>
    <option value="0">----</option>
    <option value="1">驗(yàn)舊供新</option>
    <option value="2">交舊供新</option>
    <option value="3">批量供應(yīng)</option>
    </html:select>
    name::bean的名稱。如果沒有設(shè)置,將適用于這個(gè)內(nèi)嵌表單相關(guān)的formbean的名字
    property:表單提交是送回的請(qǐng)求參數(shù)的名字,也是用來確定哪個(gè)屬性被選中的bean的屬性的名字
    value:用來表明需要被選中的選項(xiàng)

    怎么生成一個(gè)select:
    option.options = new(value, lablename)

    5. logic:iterate
    logic:iterate的兩個(gè)用法
    1. 在javaScript中初始化數(shù)組數(shù)據(jù)
    //聲明數(shù)組
    var invoiceWordCodeArray = new Array();

    //構(gòu)造函數(shù)
    function invoiceWordCode(invoiceCode,invoiceWordCode){
    this.invoiceCode = invoiceCode;
    this.invoiceWordCode = invoiceWordCode;
    }

    //初始化數(shù)據(jù)
    <logic:iterate id="item2" name="listInfoFormBean" property="wordCodeList" indexId="i">
    invoiceWordCodeArray[<bean:write name="i"/>] =
    new invoiceWordCode(
    '<bean:write name="item2" property="invoiceCode"/>',
    '<bean:write name="item2" property="invoiceWordCode"/>');
    </logic:iterate>

    2.在頁面上循環(huán)顯示一個(gè)集合中的數(shù)據(jù)
    <logic:iterate indexId="idx" id="sampleBean" name="sampleList">
    <tr>
    <td align="center" style="padding:1px 4px 0px 5px"></td><td width="150">
    <bean:write property="id" name="sampleBean"/></td><td width="150">
    <bean:write property="content" name="sampleBean"/></td><td width="150">
    <bean:write property="creator" name="sampleBean"/></td>
    </tr>
    </logic-el:iterate>
    id:頁面作用域bean的名稱,集合的別名
    name:formbean的名字,它包含property
    property:需要循環(huán)的集合的名字
    logic:iterate:需要在formbean中對(duì)集合中的VO有g(shù)et\set方法
    indexed=”true”:每次重復(fù)完成后集合當(dāng)前的索引

     



    FeedBack:
    # re: jsp-struts 常見問題集錦 --
    2006-01-17 10:59 | errorfun
    沒錯(cuò),要搞定JSP的亂碼問題就得搞懂編碼,當(dāng)時(shí)我和了一個(gè)月的時(shí)間去研究編碼,有些心得.

    首先,亂碼問題的一個(gè)主要原因是TOMCAT,TOMCAT的核心編碼用的是ISO-8859-1(默認(rèn)),所以你在頁面中怎么處理SETREQUESTENCODING,SETRESPONSEENCODING都無效,亂碼依舊,你必須在SERVER.XML文件中更改下TOMCAT的編碼,如本文提到的URIENCODING="GBK".當(dāng)然你的頁面還要設(shè)置ENCODING還有SETRESPONSEENCODING(此時(shí)才能生效),而像本文中提到的
    String S=new String(rs.getString("news").getBytes("gb2312"),"ISO8859_1");
    是為下下策,你既然設(shè)了URIENCODING,就沒必要用這方法了,這方法是在沒設(shè)的情況下用的.  回復(fù)  更多評(píng)論
      
    # re: jsp-struts 常見問題集錦 --
    2006-01-18 13:35 | 胡子魚
    nod,只要頁面的字符設(shè)定一至就行。  回復(fù)  更多評(píng)論
      
    # re: jsp-struts 常見問題集錦 --
    2006-07-11 11:28 | 胡子魚
    <html:text name="inquiryForm" property="expectedReplyDateStr" size="20" readonly="true"/> 如果size="20" ,不加引號(hào),會(huì)引起異常。  回復(fù)  更多評(píng)論
      
    # re: jsp-struts 常見問題集錦 --
    2006-07-12 15:39 | 胡子魚
    轉(zhuǎn)自:
    http://www.matrix.org.cn/thread.shtml?topicId=2624&forumId=22

    Struts常見錯(cuò)誤及原因
    Common Struts Errors and Causes

    This page contains errors and exceptions commonly encountered during web application development using Struts. Along with the exception or error messages themselves, potential causes of these errors are often listed along with links to additional resources.
    To find the error you&#39;re looking for, use your browser&#39;s Find or Search capability and input a few words that you are seeing in your error message.
    Cannot retrieve mapping for action
    錯(cuò)誤信息 javax.servlet.jsp.JspException: Cannot retrieve mapping for action /Login
    可能原因
    lNo action defined in struts-config.xml to match that specified in the JSP&#39;s <html:form action="Login.do".
    相關(guān)鏈接
    No action instance for path /xxxx could be created
    錯(cuò)誤信息 No action instance for path /xxxx could be created
    可能原因
    lSpecial Note: Because so many different things can cause this error, it is recommended that you turn your error logging/debugging levels on your web server to a high level of verbosity to see the underlying problems in trying to instantiate the action class you have written and associated with the specified action xxxx through an action mapping in the struts-config.xml file.
    lYour Action class specified in the struts-config.xml file under the class attribute of the action mapping for action xxxx cannot be found for a variety of reasons, including (but not limited to): ·Failure to place compiled .class file for the action in the classpath (needs to be under WEB-INF/classes with the appropriate directory structure underneath this that matches the package your Action class belongs to). ·Package spelling or hierarchy specified in your action class itself (using the package keyword) does not match the spelling or complete package hierachy specified for your action class in the class attribute of the action in struts-config.xml.
    lAction class specified in the /xxxx action mapping in the struts-config.xml file (class attribute) does not extend (directly or indirectly) from the Action class. In other words, your custom Action class does not extend off the Struts-provided Action class or off of another class that eventually extends the Action class (such as DispatchAction.
    lProblem in your classpath, such as web server not being able to find ApplicationResources.properties files in the WEB-INF/classes/ directory or specified subdirectory.
    lProblem in struts-config.xml file with action mapping.
    lProblem with data-sources.xml file.
    相關(guān)鏈接
    lApplication&#39;s Action classes does not extend Struts-provided Action class·
    lPackage hierarchy/directory structure specified in struts-config.xml file differs from that hierarchy specified in the actual action class&#39;s file using the package keyword.http://www.mail-archive.com/struts-user@jakarta.apache.org/msg65874.html ·
    lAction Mapping mistake in struts-config.xml:http://www.manning.com/ao/readforum.html?forum=siaao&readthread=177 ·data-sources.xml file?:http://www.caucho.com/quercus/faq/section.xtp?section_id=30
    No getter method for property XXXX of bean org.apache.struts.taglib.html.BEAN
    錯(cuò)誤信息 javax.servlet.jsp.JspException: No getter method for property username of bean org.apache.struts.taglib.html.BEAN
    可能原因
    lNo getXXXX() method defined for form field with name XXXX
    lThis can happen if the JSP/Struts developer forgets that the name of the get method will have the same spelling as the value supplied in the Struts tag&#39;s property attribute, but that case will be different and is based on JavaBean specification rules. For example, my form class should have a getUsername method if my Struts form-related tag has username as the value for its property attribute. Note the difference in case marked with emphasis on the letter "U."
    相關(guān)鏈接
    lCase can trip up the matching between get method&#39;s name and name specified in Struts taghttp://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=58&t=000163
    Exception creating bean of class org.apache.struts.action.Actionform: {1}
    錯(cuò)誤信息 javax.servlet.jsp.JspException: Exception creating bean of class org.apache.struts.action.Actionform: {1}
    可能原因
    lInstantiating Struts-provided Actionform class directly instead of instantiating a class derived off Actionform. This might occur implicitly if you specify that a form-bean is this Struts Actionform class rather than specifying a child of this class for the form-bean.
    lNot associating an Actionform-descended class with an action can also lead to this error.
    Cannot find ActionMappings or ActionformBeans collection
    錯(cuò)誤信息 javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionformBeans collection
    可能原因
    lEither the <servlet> tags for the Struts action servlet or the <servlet-mapping> tags for the .do extension mapping or both not present in the web.xml file. I saw a case where the web.xml file had no elements other than the root element and so this error was occurring.
    lTypos or spelling errors in the struts-config.xml can lead to this error message. For example, missing a slash ("/") on a closing tag can have this effect.
    lAnother element that must be present in the web.xml file is the load-on-startup element. This can be either an empty tag or can have an integer specified that indicates the priority of executing the associated servlet. The higher the number in the load-on-startup tags, the lower its priority.
    相關(guān)鏈接

    NullPointerException at ... RequestUtils.forwardURL
    錯(cuò)誤信息 java.lang.NullPointerException at org.apache.struts.util.RequestUtils.forwardURL (RequestUtils.java:1223)
    可能原因
    lMissing path attribute in the forward subelement of the action element in struts-config.xml
    相關(guān)鏈接
    Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
    錯(cuò)誤信息 javax.servlet.jsp.JspException: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
    可能原因
    lTrying to use Struts form subelement tags outside of the Struts&#39; form tag.
    相關(guān)鏈接
    lUsing form subelements outside of a form tag http://forum.java.sun.com/thread.jsp?thread=337537&forum=4&message=1384153
    Missing message for key xx.xx.xx
    錯(cuò)誤信息 javax.servlet.jsp.JspException: Missing message for key xx.xx.xx
    可能原因
    lThe key-value pair with specified key is not in ApplicationResources.properties file
    lApplicationResources.properties file not in classpath (not in WEB-INF/classes directory in specified location)
    相關(guān)鏈接
    Cannot find message resources under key org.apache.struts.action.MESSAGE
    錯(cuò)誤信息 Cannot find message resources under key org.apache.struts.action.MESSAGE
    可能原因
    lExplicitly trying to use message resources that are not available (such as ApplicationResources.properties not available
    lImplicitly trying to use message resources that are not available (such as using empty html:options tag instead of specifying the options in its body -- this assumes options are specified in ApplicationResources.properties file)
    lXML parser issues -- too many, too few, incorrect/incompatible versions
    相關(guān)鏈接
    lXML Parser Issues http://www.mail-archive.com/struts-user@jakarta.apache.org/msg15779.html

    No input attribute for mapping path /loginAction
    錯(cuò)誤信息 No input attribute for mapping path /xxxxAction
    可能原因
    lNo input attribute in action mapping in struts-config.xml file for the action with the name specified in the error message. An input attribute is not required if form validation is not performed (either because the validate attribute is set to false or because the validation method in the relevant form class is not implemented. The input attribute specifies the page leading to this action because that page is used to display error messages from the form validation.
    相關(guān)鏈接
    Strange Output Characters (頁面亂碼)
    錯(cuò)誤信息 Strange and seemingly random characters in HTML and on screen, but not in original JSP or servlet.
    可能原因
    lRegular HTML form tags intermixed incorrectly with Struts html:form tags.
    HTML標(biāo)簽與Struts標(biāo)簽不正確的混合使用
    lEncoding style used does not support characters used in page.
    使用了JSP頁面不支持的編碼
    相關(guān)鏈接
    "Document contained no data" or no data rendered on page (空白頁面)
    錯(cuò)誤信息
    l"Document contained no data" in Netscape (在Netscape中顯示“文件中無數(shù)據(jù)”)
    lNo data rendered (completely empty) page in Microsoft Internet Explorer(在IE中為空白頁面,無任何顯示信息)
    可能原因
    lEmploying a descendent of the Action class that does not implement the perform() method while using the Struts 1.0 libraries. Struts 1.1 Action child classes started using execute() rather than perform(), but is backwards compatible and supports the perform() method. However, if you write an Action-descended class for Struts 1.1 with an execute() method and try to run it in Struts 1.0, you will get this "Document contained no data" error message in Netscape or a completely empty (no HTML whatsoever) page rendered in Microsoft Internet Explorer.
    l用Struts1.1寫的應(yīng)用在struts1.0環(huán)境中運(yùn)行時(shí),可能出現(xiàn)此問題。
    相關(guān)鏈接


    其它錯(cuò)誤信息
    編譯JSP文件時(shí)出現(xiàn)錯(cuò)誤:
    java.lang.NullPointerException
    error:org.apache.jasper.JasperException: Error compiling \JSPs\security\appUserCreate.jsp
    可能原因:
    JSP頁面中的Struts標(biāo)記有語法錯(cuò)誤。
    例如:<bean:message key=”button.submit”> 錯(cuò)誤原因:右邊的括號(hào)前缺少斜杠“/”
    正確的為:<bean:message key=”button.submit”/>

    不同語言資源文件中的Key不匹配。  回復(fù)  更多評(píng)論
      
    # re: jsp-struts 常見問題集錦 --
    2006-08-22 14:19 | 胡子魚
    log4J配置:轉(zhuǎn)自javaeye

    怕麻煩的話可以考慮放應(yīng)用下的某一個(gè)目錄下,整個(gè)Servlet,專門用來設(shè)置環(huán)境變量和讀取log4j的配置文件 ,初始化Servlet的時(shí)候,應(yīng)用程序的目錄是固定的 ,
    可以通過System.setProperty("webappHome",this.getServletContext().getRealPath(""));來設(shè)置當(dāng)前應(yīng)用的目錄的絕對(duì)路徑為java內(nèi)部的環(huán)境變量,在log4j的配置文件里面用${webappHome}/WEB-INF/conf/log/Application.log 來配置該文件的絕對(duì)路徑就可以了  回復(fù)  更多評(píng)論
      
    # re: jsp-struts 常見問題集錦 --
    2007-10-26 14:20 | freeman1984
    可以用filter解決編碼問題  回復(fù)  更多評(píng)論
      
    <2006年1月>
    25262728293031
    1234567
    891011121314
    15161718192021
    22232425262728
    2930311234

    常用鏈接

    留言簿(82)

    隨筆分類(59)

    文章分類(21)

    相冊(cè)

    收藏夾(40)

    GoodSites

    搜索

    •  

    積分與排名

    • 積分 - 1267305
    • 排名 - 22

    最新評(píng)論

    閱讀排行榜

    主站蜘蛛池模板: 亚洲精品久久久久无码AV片软件| 亚洲日韩欧洲无码av夜夜摸| 亚洲国产视频一区| 午夜高清免费在线观看| 亚洲精品日韩专区silk| 亚洲一区二区免费视频| 亚洲天堂中文字幕在线观看| 日本黄网站动漫视频免费| 亚洲日韩乱码久久久久久| 日本亚洲免费无线码| 亚洲一区精彩视频| 免费黄色app网站| 看全免费的一级毛片| 国产精品亚洲αv天堂无码| 国产性生大片免费观看性| 亚洲理论电影在线观看| 国产麻豆成人传媒免费观看| 香蕉视频在线观看亚洲| 在线观看免费人成视频| 亚洲av片在线观看| 亚洲人AV永久一区二区三区久久| 免费在线观影网站| 亚洲欧洲中文日产| 永久黄网站色视频免费观看| 一级毛片视频免费观看| 亚洲产国偷V产偷V自拍色戒| 久久九九兔免费精品6| 亚洲高清国产拍精品熟女| 久久精品亚洲男人的天堂| 亚洲码和欧洲码一码二码三码| 国产成人综合久久精品免费| a级毛片免费观看在线| 久久精品国产亚洲av水果派| 日本特黄a级高清免费大片| 国产精品玖玖美女张开腿让男人桶爽免费看| 亚洲精品乱码久久久久久按摩 | 午夜免费福利影院| 久久久WWW免费人成精品| 亚洲码一区二区三区| 国产精品国产免费无码专区不卡| 免费无码H肉动漫在线观看麻豆|