struts入門級問題,線上等!!!!
初學struts,環境為jbx+apusic,問題非常簡單,請往下看,謝謝!
問題如下:
登陸頁面hello.jsp有一欄位為username,現透過一actionform對其進行包裝,並對username是否為空進行認證,如果該欄位為空,返回hello.jsp,並在該頁上顯示錯誤資訊。(我的感覺是漏做了一步配置)
actionform驗證碼為:
public ActionErrors validate(
ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if ((getUsername()==null)|| (getUsername().equals(""))) {
// if the name is empty --> errors
errors.add("username", new ActionError("error.customer.name"));
System.out.println("errors....");
}
return errors;
}
同時在ApplicationResources.properties裡設定具體錯誤顯示資訊:
# Optional header and footer for <errors/> tag.
errors.header=<hr><h3>Errors</h3><ul>
errors.footer=</ul><hr>
error.customer.name=<li>Name is empty
並在hello.jsp里加如<html:errors/>
但執行時總出現錯誤:
2003-05-26 16:50:37 錯誤 [apusic.webapp.struts.war./struts] 執行Servlet時發生錯誤。
javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE
at org.apache.struts.util.RequestUtils.retrieveMessageResources(RequestUtils.java:1103)
at org.apache.struts.util.RequestUtils.present(RequestUtils.java:1408)
at org.apache.struts.taglib.html.ErrorsTag.doStartTag(ErrorsTag.java:196)
at _jspx._hello__jsp__1._jspService(hello.jsp:26)
at com.apusic.servlet.jsp.HttpJspPageImpl.service(Unknown Source:43)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.apusic.servlet.http.lllllIIllIIlIlIl._$1(Unknown Source:664)
at com.apusic.servlet.http.lllllIIllIIlIlIl._$1(Unknown Source:562)
at com.apusic.servlet.jsp.JspServlet.service(Unknown Source:247)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.apusic.servlet.http.lllllIIllIIlIlIl._$1(Unknown Source:664)
at com.apusic.servlet.http.IIIIIlIIIlIIIlIl.forward(Unknown Source:121)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
at org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1012)
at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:980)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.apusic.servlet.http.lllllIIllIIlIlIl._$1(Unknown Source:664)
at com.apusic.servlet.http.lllllIIllIIlIlIl._$1(Unknown Source:504)
at com.apusic.servlet.http.IIlIIIIlIIlIIllI._$1(Unknown Source:169)
at com.apusic.servlet.http.lllIIlIIIIIlIlII._$1(Unknown Source:283)
at com.apusic.servlet.http.llIlllllIllIIIll._$1(Unknown Source:25)
at com.apusic.servlet.http.lIllIIllllllIlll._$3(Unknown Source:238)
at com.apusic.servlet.http.lIllIIllllllIlll._$1(Unknown Source:142)
at com.apusic.servlet.http.lIllIIllllllIlll.run(Unknown Source:70)
相關文章
- struts和spring結合的問題(線上等~~)Spring
- 連線資料庫問題!!! ~~~~急急急急急!!~~~線上等資料庫
- 剛入門,請banq和tyrones 以及各位賜教Struts的問題
- struts2入門
- Struts入門例項
- lucene入門問題
- 求助,線上等待,編譯EJB問題。。。。。編譯
- Struts入門初步知識
- Struts快速入門(二) (轉)
- Struts快速入門(三) (轉)
- Struts快速入門(四) (轉)
- Struts1入門級程式hello world(解決struts1中文亂碼)
- 急問:使用JBuilder2005開發Struts應用的時候遇到的奇怪問題-----請指教(線上等)UI
- Struts2基礎入門
- CAD入門級練習題
- Struts Tiles應用問題
- struts原始碼的問題原始碼
- struts2 namespace問題namespace
- 求教併發問題(非常急,線上等,高手賜教)
- 新手入門 Golang 常見問題Golang
- 線上問題排查神器入門——Arthas
- java 入門篇 問題集錦Java
- Python入門:A+B問題Python
- struts 自定義validate 問題
- Struts Tiles 和 session的問題Session
- struts怪問題 高手請進
- Struts中global-forwards問題Forward
- Struts2框架快速入門筆記框架筆記
- jive初學者請教安裝問題(線上等!多謝!)
- XML入門常見問題(3)(轉)XML
- XML入門常見問題(2)(轉)XML
- XML入門常見問題(1)(轉)XML
- 20160427Struts2--入門1
- struts的validator框架問題?急框架
- [求助]..新手!遇到struts呼叫sessionbean問題?SessionBean
- Spring+struts 的問題 急!~~Spring
- 線上等待。。。。安裝第三步,資料庫無法建立連線問題 十萬火急!!!!!資料庫
- java學習中遇到的問題 請高手幫忙 線上等Java