PDA

View Full Version : Extjs spring simple submit user detail form gives 404 requested resource not availabl



NileshB
21 Oct 2013, 8:17 PM
when i click on submit button it gives mi 404 requested resource not available error.can anyone help mi with that
this is my index.jsp

Ext.onReady(function(){ Ext.QuickTips.init();
var login = new Ext.FormPanel({
headers: {'Content-Type':'text/html'},


items:[{
fieldLabel:'Name',
name:'Name',
allowBlank:false
},{
fieldLabel:'age',
name:'age',
allowBlank:false
},{
fieldLabel:'id',
name:'id',
allowBlank:false
}],
buttons:[{
text:'Submit',
formBind: true,

handler:function(){
login.getForm().submit({
method:'POST',
url: '/HelloWeb/addStudent.htm' ,
// action:'/HelloWeb/addStudent.htm',

}
}]
});

this is my spring controller

@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";
}


this is 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>

this is web.xml

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<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>

Gary Schlosberg
22 Oct 2013, 5:06 AM
What version of ExtJS are you using?

NileshB
22 Oct 2013, 8:37 PM
now i am using 3.4 but i aslo want to know how to do it in 4.1 version .

evant
22 Oct 2013, 9:14 PM
Exactly as it says, it's a 404, meaning you're not pointing it to the correct URL.

NileshB
22 Oct 2013, 9:23 PM
how to do it? i have posted my code what changes i have to do in it???

evant
22 Oct 2013, 9:41 PM
I'm not overly familiar with Java. You should post this on a Java forum, it's not really related to Ext at all.