<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" /> 有錯嗎? 暈哦,就是錯了,得把readOnly="true"改為readonly="true",可是在javasript下,用函數去指定true或者false,O就必須大寫…… 所以就去找了以下一篇。

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

    Java 開發中遇到的亂碼問題

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

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

    Unicode的空間分配:
    以下Unicode區位碼均以16進制表示
    Unicode的前256個字符和ISO-8859-1(西歐字母)完全相同,其中前半段就是Ascii(u+0000到u+00FF)。每個ISO-8859-1碼前面補上一個空byte(0x00)后才是相應的Unicode碼。
    和我們切身相關的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(下劃線空位)是否足以用來代表區位中各Unicode碼,剛好夠用。
    那么當程序處理UTF-8編碼文件時,如何得知一個字符的疆界落在哪里?還有到底他是以三種形式那一中出現呢?
    每個以UTF-8編碼的字符,不管是以一、二、三個bytes出現,第一個byte前端都清楚地標示了該字符的byte總數。如110種有兩個1,代表這種字符是以第二種方式出現,由兩個bytes組成。而1110有三個1,表示這種字符一點種方式出現,由三個字節組成。
    每個多重byte的UTF-8編碼有一個共同的通性,即其中的第二個第三個byte, 一律以10兩個bits開頭。由于其中的最高位總設成1,可以很容易和那些在UTF-8中只用一個Byte的ASCII字元區分開來,方便偵錯。
    因為上述設計特點,UTF-8和Unicode之間,可以很容易做雙向自由轉換,而不會丟失任何資料。

    解決辦法:亂碼問題在 NT操作系統我沒怎么碰到過,但是在UNIX 或LINUX系統上出現的比較多
    由于操作系統和使用環境不一樣,產生亂碼的方式也不一樣,但是如果掌握了上面的Unicode 編碼原理,自己仔細分析一下,很多問題便可迎刃而解。
    下面看看幾個常見的例子。
    1. 如果一些網站服務器例如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 設成GBK或GB2312
    2. 表單中或傳遞字符串:本來輸入的漢字是正常的,但是提交后再顯示出來是亂碼,因為提交的一般是 ISO8859編碼,所以顯示的時候要轉成GB2312編碼:

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

    Java_struts 入門快速手冊

    ----by omencathay
    Struts
    簡介
    1、 Struts基于MVC模式 Model(Bean) ,View(jsp文件), Control (Action類,ActionForm類)
    2、 開發準備
    struts http://jakarta.apache.org/struts
    jdk1.2版本以上 http://java.sun.com/j2se
    Xerces XML parser http://xml.apache.org/xerces-j
    下載struts后,解壓zip文件到一個臨時目錄;然后拷貝struts.jar, jakarta-oro.jar, jdbc2_0-stdext.jar和common*.jar文件到你所應用struts的WEB-INF/lib目錄下;拷貝struts*.tld文件和*.dtd文件到WEB-INF目錄下,確定該才提到的所有的jar包都在web應用服務器的 classpath環境變量上設置。
    3、 配置 (兩個xml文件:web.xml, struts-config.xml)
    配置web.xml,第一件事情就是注冊組件action servlet,<servlet> .. </servlet>標簽封裝了整個struts 框架的應用程序
    <!-- 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>
    每個<action>元素定義了特定的功能與相關聯的動作類, 大多數action元素至少包括以下三個部分。
    Path-----應用程序映射的路徑
    Type-----需要的完整的包和類
    Name-----action應用的<form-bean>元素的名稱

    <forward>標簽告訴struts框架將要跳轉到哪個jsp頁面;
    <data-sources>標簽給出數據源屬性;


    4、 struts核心標簽庫示例
    1. Html:form
    屬性:onsubmit

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

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

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

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


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

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

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

    這一點可以在html:text中加入屬性 readonly=”true”來實現

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

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

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

    //構造函數
    function invoiceWordCode(invoiceCode,invoiceWordCode){
    this.invoiceCode = invoiceCode;
    this.invoiceWordCode = invoiceWordCode;
    }

    //初始化數據
    <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.在頁面上循環顯示一個集合中的數據
    <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:需要循環的集合的名字
    logic:iterate:需要在formbean中對集合中的VO有get\set方法
    indexed=”true”:每次重復完成后集合當前的索引

     



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

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

    Struts常見錯誤及原因
    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
    錯誤信息 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".
    相關鏈接
    No action instance for path /xxxx could be created
    錯誤信息 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.
    相關鏈接
    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
    錯誤信息 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."
    相關鏈接
    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}
    錯誤信息 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
    錯誤信息 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.
    相關鏈接

    NullPointerException at ... RequestUtils.forwardURL
    錯誤信息 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
    相關鏈接
    Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
    錯誤信息 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.
    相關鏈接
    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
    錯誤信息 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)
    相關鏈接
    Cannot find message resources under key org.apache.struts.action.MESSAGE
    錯誤信息 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
    相關鏈接
    lXML Parser Issues http://www.mail-archive.com/struts-user@jakarta.apache.org/msg15779.html

    No input attribute for mapping path /loginAction
    錯誤信息 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.
    相關鏈接
    Strange Output Characters (頁面亂碼)
    錯誤信息 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標簽與Struts標簽不正確的混合使用
    lEncoding style used does not support characters used in page.
    使用了JSP頁面不支持的編碼
    相關鏈接
    "Document contained no data" or no data rendered on page (空白頁面)
    錯誤信息
    l"Document contained no data" in Netscape (在Netscape中顯示“文件中無數據”)
    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寫的應用在struts1.0環境中運行時,可能出現此問題。
    相關鏈接


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

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

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

    常用鏈接

    留言簿(82)

    隨筆分類(59)

    文章分類(21)

    相冊

    收藏夾(40)

    GoodSites

    搜索

    •  

    積分與排名

    • 積分 - 1267192
    • 排名 - 22

    最新評論

    閱讀排行榜

    主站蜘蛛池模板: 日本无吗免费一二区| 日本视频在线观看永久免费| 亚洲爆乳无码专区www| 在线观看亚洲AV每日更新无码| 亚洲中文字幕无码一去台湾 | 99久久综合国产精品免费| 免费在线视频你懂的| 久久笫一福利免费导航| 可以免费看黄视频的网站| 免费黄色网址入口| 国产免费小视频在线观看| 亚洲七七久久精品中文国产| 精品亚洲成α人无码成α在线观看 | 香蕉免费一级视频在线观看| 一级成人生活片免费看| 手机看片国产免费永久| 精品视频一区二区三区免费| 精品无码国产污污污免费网站| 四虎免费影院ww4164h| 好先生在线观看免费播放| 国产精品免费小视频| 亚洲综合色在线观看亚洲| 国产亚洲精品岁国产微拍精品| 久久亚洲AV无码精品色午夜| 天天爽亚洲中文字幕| 美女尿口扒开图片免费| 久久精品无码免费不卡| 99re6在线精品视频免费播放 | 久久久受www免费人成| 一级毛片**不卡免费播| 成人性生交大片免费看无遮挡| 日韩免费视频播放| 久久国产成人精品国产成人亚洲| 亚洲AV无码一区二区乱孑伦AS| 91亚洲视频在线观看| 国产亚洲精品欧洲在线观看| 99在线免费视频| 久久天天躁狠狠躁夜夜免费观看| 免费**毛片在线播放直播| 久久精品国产96精品亚洲| 亚洲人精品亚洲人成在线|