最近在看SSH的视频,跟着做了小demo,报错查了2边还没解决,求解
先大概讲一下配置文件的主要内容
spring-content.xml:
<context:component-scan base-package="action" />struts.xml
<struts>
<package name="demo" namespace="/demo" extends="struts-default">
<action name="hello" class="helloAction" method="execute">
<result name="success">/WEB-INF/msg.jsp</result>
</action>
</package>web.xml中配ContextLoaderListener、contextConfigLocation、StrutsPrepareAndExecuteFilterHelloAction中用的默认方法execute(),简单输出一下:
@Controller
@Scope("prototype")
public class HelloAction {

public String execute(){
System.out.println("Hello Action");
return "success";
}}现在问题是:
<action>标签class如果写类的全名action.HelloAction,可以执行成功,页面和控制台有输出。
如果在Action类上加注解,<action>里class属性换成别名helloAction,则报错:
Unable to instantiate Action, helloAction,  defined for 'hello' in namespace '/demo'No Scope registered for scope 'protype'