關於struts中html:errors/的問題
檔案內容如下,為什麼我的<html:errors/>顯示不出來任何內容?而我手工寫的一段程式碼可以把Errors顯示出來。請大家幫忙,謝謝
<%@ page contentType="text/html; charset=GBK" %>
<%@ page language="java"%>
<%@ page import="org.apache.struts.action.ActionErrors"%>
<%@ page import="org.apache.struts.action.ActionError"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<html:html>
<head>
<title>File Upload</title>
</head>
<body>
<%
ActionErrors aes=(ActionErrors)request.getAttribute("org.apache.struts.action.ERROR");
if(aes!=null){
ActionError ae=(ActionError)aes.get().next();
%>
<%=ae.getKey()%>
<%
}
%>
<html:errors/>
<html:form action="/uploadFile" enctype="multipart/form-data">
<html:file property="file"/>
<html:submit value="Upload"></html:submit>
</html:form>
</body>
</html:html>
生成錯誤資訊的程式碼如下:
ActionErrors aes=new ActionErrors();
..........
ActionError ae=new ActionError(file.getFileName()+"上傳成功");
aes.add(ActionErrors.GLOBAL_ERROR,ae);
saveErrors(request,aes);
return new ActionForward(mapping.getInput());
<%@ page contentType="text/html; charset=GBK" %>
<%@ page language="java"%>
<%@ page import="org.apache.struts.action.ActionErrors"%>
<%@ page import="org.apache.struts.action.ActionError"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<html:html>
<head>
<title>File Upload</title>
</head>
<body>
<%
ActionErrors aes=(ActionErrors)request.getAttribute("org.apache.struts.action.ERROR");
if(aes!=null){
ActionError ae=(ActionError)aes.get().next();
%>
<%=ae.getKey()%>
<%
}
%>
<html:errors/>
<html:form action="/uploadFile" enctype="multipart/form-data">
<html:file property="file"/>
<html:submit value="Upload"></html:submit>
</html:form>
</body>
</html:html>
生成錯誤資訊的程式碼如下:
ActionErrors aes=new ActionErrors();
..........
ActionError ae=new ActionError(file.getFileName()+"上傳成功");
aes.add(ActionErrors.GLOBAL_ERROR,ae);
saveErrors(request,aes);
return new ActionForward(mapping.getInput());
相關文章
- 請問關於Struts的Indexed屬性的問題Index
- 請教高手 關於STRUTS DATASOURCE的問題
- 關於struts開發時遇到的問題
- struts 中多個html:text賦初值問題HTML
- 初學者想問一個關於Struts路徑的問題
- 關於struts標籤<html:link/>中漢字編碼的問題HTML
- 15個關於HTML的入門問題HTML
- struts的多模組應用問題--html:formHTMLORM
- 關於struts,webwork,jetspeed,turbine等的適用性問題Web
- 關於“Struts with XSLT and XML ”的Model2X的問題XML
- Struts中的Action跳轉問題!附關鍵程式碼
- 一個很奇怪的問題:關於struts自定義標籤
- HTML中關於class內容空格多類名的問題詳解HTML
- Struts中html:options的使用HTML
- 耽誤大家電時間 詢問關於struts 中使用Cookie的問題Cookie
- 一個關於Struts傳引數的問題,請高手來看看............
- 關於工作中遇到的問題
- 關於cuda中的函式問題函式
- 關於 iOS 10 中 ATS 的問題iOS
- Struts中global-forwards問題Forward
- 關於 mysql 中的 rand () 查詢問題MySql
- 關於 Laravel 中 Ajax 問題的小結Laravel
- 關於iOS10中ATS的問題iOS
- java中關於Map的九大問題Java
- 關於考勤模組中設計的問題
- 關於jsp中轉發的問題JS
- 急問:關於servlet中得session問題ServletSession
- 關於html的a標籤的target="__blank "的安全漏洞問題HTML
- 關於J2ee的struts結構不能解決的幾個問題
- 急急急急!Struts自定義標籤html:text 問題HTML
- 關於字串中取相同的字元問題(小學題)字串字元
- Elasticsearch中關於transform的一個問題分析ElasticsearchORM
- 關於頁面中彈窗的定位問題
- 關於QGraphicsView中的物件移動問題. zView物件
- 關於mysql中limit最佳化的問題MySqlMIT
- 新手關於jbuilder中除錯session的問題UI除錯Session
- [求助]關於Appfuse中Form的scope問題APPORM
- 關於python中填充缺失值的問題Python