呵呵,沒看完
你把 struts-config.xml 配置中的: <action path="/login" type="com.xxx.mailuser.web.LoginAction" name="loginForm" scope="request" input="/user/login.jsp" validate="true">
<forward name="success" path="/coremail/" /> validate="true" 改成 validate="false" 試一下 <action path="/login" type="com.xxx.mailuser.web.LoginAction" name="loginForm" scope="request" input="/user/login.jsp" validate="false">
<forward name="success" path="/coremail/" />
你把 struts-config.xml 配置中的: <action path="/login" type="com.xxx.mailuser.web.LoginAction" name="loginForm" scope="request" input="/user/login.jsp" validate="true">
<forward name="success" path="/coremail/" /> validate="true" 改成 validate="false" 試一下 <action path="/login" type="com.xxx.mailuser.web.LoginAction" name="loginForm" scope="request" input="/user/login.jsp" validate="false">
<forward name="success" path="/coremail/" />
二楼的是不是说 在struts中 设置encoding="UTF-8" ,我设置了,还用editplus用utf-8另存了
还是不行怎么办?
我第一次用struts
<%@ page import="org.apache.struts.action.*, org.apache.struts.Globals" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %><%@ page contentType="text/html; charset=gb2312" language="java" errorPage="" %>
<%@ page import="org.apache.struts.action.*, org.apache.struts.Globals" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
errors.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("errors.login.userNameNotExist"));你用jdk1.42的话,应该这样来写:
errors.add("显示错误的名字",new ActionError("errors.login.userNameNotExist"));
我以前也试过,1.5以下的版本不能用ActionMessage来保存错误信息。
建议你试一下!!!!!
<action path="/login" type="com.xxx.mailuser.web.LoginAction" name="loginForm" scope="request" input="/user/login.jsp" validate="true">
<forward name="success" path="/coremail/" />
<% ActionErrors errors = new ActionErrors();
errors.add("property1", new ActionError("property1message1"));
request.setAttribute(Globals.ERROR_KEY, errors);
%>
1、你的资源文件没有配置好。
2、有些JDK只能用new ActionError("property1message1")来保存错误。
3、你调用了
saveErrors(errors,request)或request.setAttribute(“error”,errors)方法没有。