Struts2错误:Developer Notification (set struts.devMode to false to disable this message)

版权声明:转载前请留言获得作者许可,转载后标明作者Roger_CoderLife与原文链接。创作不易,感谢您的支持! https://blog.csdn.net/Roger_CoderLife/article/details/85085430

Struts2发现错误: 

2018-12-18 23:44:34,136 [http-bio-8082-exec-8] ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor - Developer Notification (set struts.devMode to false to disable this message):

Unexpected Exception caught setting 'repassword' on 'class cn.tx.controller.EmpAction: Error setting expression 'repassword' with value ['123456', ]
 

刚刚看到这个问题的时候,可能是以下几种情况:

1.传输的数据类型与setting"XXX"的数据类型不匹配。

    执行:查找了所有相关数据,没有任何结果。

2.Action当中没有写‘XX’的setter方法。

   执行:在Action中添加get和set方法,同样还是没有结果。

3.输入值超出了范围。

   想想:不可能,用的是Integer类型,怎么可能会超出范围。

当再次回到问题时,发现自己忽略了:Developer Notification (set struts.devMode to false to disable this message)。

原因分析:

当struts.devMode设置为true时,html表单数据中有和action属性匹配不上的参数名时就会被这样显示出来,没什么大碍,就是为了便于使用者调试。struts.devMode设置为false就没有了。可能它的log级别设置的容易让人忽略。

执行:

将struts.devMode设置为false,代码如下:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
	"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
	"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
	<constant name="struts.devMode" value="false"></constant>
	<constant name="struts.ui.theme" value="simple"></constant>
	
	<package name="erp" extends="struts-default">

	   <action name="erp_*">
			<result>/WEB-INF/jsps/{1}.jsp</result>
	   </action>	
		 
	   <action name="emp_*" class="empAction" method="emp_{1}">
			<result name="success">/WEB-INF/jsps/emp/{1}.jsp</result>
	   </action>
	   
	   <action name="ajax_emp_*" class="empAction" method="ajax_emp_{1}"/>
	   	
	   <action name="dep_*" class="depAction" method="dep_{1}">
			<result name="success">/WEB-INF/jsps/dep/{1}.jsp</result>
	   </action>
	</package>
	
</struts>

重新配置后,重启Tomcat,Struts2的错误就消失了。

作者:Roger_CoderLife

链接:https:blog.csdn.net/Roger_CoderLife/article/details/85085430

本文为Roger_CoderLife的原创文章,著作权归作者所有,转载请注明原文出处,欢迎转载!

猜你喜欢

转载自blog.csdn.net/Roger_CoderLife/article/details/85085430