redirect="false" />最好把FORM里的东西也贴出来
解决方案 »
- 关于对指定的字段内容修改,求助各位
- Struts2实现ajax返回数据失败
- 郁闷!总是报异常说找不到Action
- java页面标签和显示的问题
- log4j 和struts2整合出现了问题
- java内部类如何映射为数据库实体?
- spring配置事务管理,dao用了session,session关闭是由Spring 自动完成吗?
- 最近几天在学STRUTS,有个超级菜的问题
- 值得去考SUN的认证SCBCD吗?
- com.alibaba.druid.proxy.jdbc.ClobProxyImpl cannot be cast to oracle.sql.CLOB
- 在深圳学JAVA请有丰富经验的老师做家教。时间2-3小时/天,有意请留下联系方式,待遇面谈。
- struts 2 的 select 问题 请指教
HttpServletRequest request) {
// TODO Auto-generated method stub
ActionErrors errors = new ActionErrors();
//服务器端验证
if (this.username==null || "".equals(this.username))
{
errors.add("username", new ActionMessage("username.null"));
}
if (this.password==null || "".equals(this.password))
{
errors.add("password", new ActionMessage("password.null"));
}
return errors;
}
如果我把Action中的errors.add("name", new ActionMessage("login.error"));
改为errors.add("name", new ActionMessage("login.error",false));
,再按照2楼的方法将struts-config.xml中的redirect改为false,能显示错误信息了,但是显示的不是我在ApplicationResources里定义的错误信息,而是错误信息的key值,比如应该显示“验证码错误!”它只显示vertifycode.error(这是我定义的验证码错误信息的key值),如果我将action中的false去掉又不显示错误信息了,连vertifycode.error都不显示。
还有个问题,启动项目的时候会在C盘根目录下面自动生成test.log,但是我在项目中并没有使用log4j,这是什么原因?
test.log内容:
main INFO - Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
main INFO - Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
main INFO - Initializing, config='ApplicationResources_ch_CN', returnNull=true
main INFO - Tiles definition factory loaded for module ''.
main INFO - Loading validation rules file from '/WEB-INF/validator-rules.xml'
main INFO - Loading validation rules file from '/WEB-INF/validation.xml'望高手指点!!