-
2 Sep 2012 1:56 AM #1Sencha Premium Member
- Join Date
- Apr 2012
- Location
- Mumbai, India
- Posts
- 191
- Vote Rating
- -1
- Answers
- 10
Unanswered: ExtJs4.1 - Form data not being submitted to server
Unanswered: ExtJs4.1 - Form data not being submitted to server
Folks,
I am using ExtJS 4.1. I am trying to submit a form using Ext.Ajax.request() and REST on server side.
Here's my Ajax request,
Server Side code :-Code:var params = form.getValues(); Ext.Ajax.request({ url: 'feedback/newFeedback.action', params: params, success: function(response) { Ext.Msg.alert('Success'); }, failure: function(response) { Ext.Msg.alert('Failure', 'Error : '+response.responseText); }, callback: function(options, success, response) { Ext.Msg.alert('Title', response.responseText); } });
When I click on Submit button, I get the below errorCode:@RequestMapping(value="/feedback/newFeedback.action") public @ResponseBody Map<String,? extends Object> create(@RequestBody Object data) throws Exception { try{ List<Feedback> feedbacks = feedbackService.create(data); return getMap(feedbacks); // this will return json once control reaches here .. } catch (Exception e) { return getModelMapError("Error trying to create contact."); } }
What am I missing ?message: /feedback/newFeedback.action
description The requested resource (/feedback/newFeedback.action) is not available.--
Bomslang,
Software Engineer,
HTML5 Developer | ExtJS, Sencha Touch, GXT Passionate | Json Supporter
Twitter : @bomslang
----------------------------------------------------------------------------------
# Learn about Sencha Products via it's Documentation : ExtJS | Sencha Touch | GXT
# Check for correct Json here : JSONLint.com
# Want to code Sencha Touch Online ? Try SenchaFiddle.com
# Want to code and test ExtJS Online ? Try http://ext4all.com/ & http://jsfiddle.net/
# Must Read : 20 things to avoid / do when starting with ExtJS or Sencha Touch
-
2 Sep 2012 3:32 AM #2Sencha Premium Member
- Join Date
- Apr 2012
- Location
- Mumbai, India
- Posts
- 191
- Vote Rating
- -1
- Answers
- 10
Now, if I try out with form.submit(), it throws me a different exception
Exception :-Code:var form = Ext.getCmp('fdForm').getForm(); if(form.isValid()) { form.submit({ waitMsgTitle: 'Title', url: 'feedback/newFeedback.action', method: 'POST', success: function(response) { Ext.Msg.alert('Success'); }, failure: function(response) { Ext.Msg.alert('Failure'); } }); }
What is happening ? What is wrong with my code ?Code:POST http://localhost:8080/faq/feedback/newFeedback.action 415 (Unsupported Media Type) ext-all-debug.js:37622 Ext.define.request ext-all-debug.js:37622 Ext.define.doSubmit ext-all-debug.js:30042 Ext.define.run ext-all-debug.js:30016 (anonymous function)
Any sample example of form submission using REST ?
--
Bomslang,
Software Engineer,
HTML5 Developer | ExtJS, Sencha Touch, GXT Passionate | Json Supporter
Twitter : @bomslang
----------------------------------------------------------------------------------
# Learn about Sencha Products via it's Documentation : ExtJS | Sencha Touch | GXT
# Check for correct Json here : JSONLint.com
# Want to code Sencha Touch Online ? Try SenchaFiddle.com
# Want to code and test ExtJS Online ? Try http://ext4all.com/ & http://jsfiddle.net/
# Must Read : 20 things to avoid / do when starting with ExtJS or Sencha Touch
-
2 Sep 2012 6:30 PM #3
It seems that your webserver does not support request to 'http://localhost:8080/faq/feedback/newFeedback.action'. What will happen if you will access to this url by using your browser?
-
3 Sep 2012 4:42 AM #4Sencha Premium Member
- Join Date
- Apr 2012
- Location
- Mumbai, India
- Posts
- 191
- Vote Rating
- -1
- Answers
- 10
Thanks for your reply.
I tried running it under both - Eclipse Internal web browser as well as Chrome.
Both shows up the same error.--
Bomslang,
Software Engineer,
HTML5 Developer | ExtJS, Sencha Touch, GXT Passionate | Json Supporter
Twitter : @bomslang
----------------------------------------------------------------------------------
# Learn about Sencha Products via it's Documentation : ExtJS | Sencha Touch | GXT
# Check for correct Json here : JSONLint.com
# Want to code Sencha Touch Online ? Try SenchaFiddle.com
# Want to code and test ExtJS Online ? Try http://ext4all.com/ & http://jsfiddle.net/
# Must Read : 20 things to avoid / do when starting with ExtJS or Sencha Touch


Reply With Quote