Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring mvc extjs spring 404请求的资源不可用_Spring Mvc_Extjs - Fatal编程技术网

Spring mvc extjs spring 404请求的资源不可用

Spring mvc extjs spring 404请求的资源不可用,spring-mvc,extjs,Spring Mvc,Extjs,我正在从事extjs spring演示项目。当我点击submit按钮时,它会给我404请求的资源不可用。我对extjs和spring都是新手。如何解决这个问题 这是我的index.jsp Ext.onReady(function(){ Ext.QuickTips.init(); var login = new Ext.FormPanel({ items:[{ fieldLabel:'Name', name:'Name'

我正在从事extjs spring演示项目。当我点击submit按钮时,它会给我404请求的资源不可用。我对extjs和spring都是新手。如何解决这个问题

这是我的index.jsp

Ext.onReady(function(){
            Ext.QuickTips.init();
var login = new Ext.FormPanel({ 
items:[{ 
            fieldLabel:'Name', 
            name:'Name', 
            allowBlank:false 
        },{ 
            fieldLabel:'age', 
            name:'age', 
            allowBlank:false 
        },{ 
            fieldLabel:'id', 
            name:'id', 
            allowBlank:false 
        }],
 buttons:[{ 
            text:'Submit',
            formBind: true,  
            // Function that fires when user clicks the button 
            handler:function(){ 
             login.getForm().submit({ 
                    method:'POST',
                    url: 'HelloWeb/addStudent.htm' ,
                    //url: '/HelloWeb/addStudent.htm' ,
                    //action:'HelloWeb/addStudent.htm',
          }); 
            } 
        }] 
});
这是我的控制器

@RequestMapping(value = "/addStudent", method = RequestMethod.POST)

public String addStudent(@ModelAttribute("SpringWeb")Student student, 
ModelMap model) {
  model.addAttribute("name", student.getName());
  model.addAttribute("age", student.getAge());
  model.addAttribute("id", student.getId());
  return "result";
}
这是web.xml

  <servlet>
    <servlet-name>HelloWeb</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>2</load-on-startup>
 </servlet>
 <servlet-mapping>
    <servlet-name>HelloWeb</servlet-name>
    <url-pattern>*.htm</url-pattern>
 </servlet-mapping>

你好
org.springframework.web.servlet.DispatcherServlet
2
你好
*.htm
这是HelloWeb-servlet.xml

<context:component-scan base-package="nil" />

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  <property name="prefix" value="/WEB-INF/jsp/" />
  <property name="suffix" value=".jsp" />
</bean>

如果我没有错

您提供的URL是

url: '/addStudent.htm' ,
请在URL中添加上下文路径

url : '<contextPath>/addStudent.htm'
url:'/addStudent.htm'

ContextPath通常是war文件的名称。试着让大家知道

我也试过了,但它还是给了我同样的错误我的war文件名是HelloWeb…所以我试过url:'HelloWeb//addStudent.htm'和url:'HelloWeb//addStudent.htm'和