Unable to instantiate Action, loginAction, defined for 'loginAction' in namespace '/'loginAction

这个是什么错误

1.不能实例化Action,loginAction 的命名空间错了。
你把xml配置文件贴上来看下。
2.检查struts.xml中class路径是否错误
3.检查页面中调用action的地方是否有拼写错误。追问


/main.jsp
/index.html

温馨提示:答案为网友推荐,仅供参考
第1个回答  2018-10-26

1、如果项目没有使用Spring,则struts.xml配置文件中,这个action的class属性的路径没有写完整,应该是包名.类名

2、如果项目使用了Spring,那就是applicationContext.xml里面没有为这个action定义bean。这样strus.xml中的对应action的class属性的值就是Spring配置文件中bean的id
---------------------
作者:吴孟达
来源:CSDN
原文:网页链接

解决方法:

当项目只用了struts时,不会报错正常运行.

当项目使用了spring,就要把action要配置在applicationContext.xml中