• Post Reply Bookmark Topic Watch Topic
  • New Topic

Form not posting data

 
kuhu vora
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am new to creating web applications using Spring and having issues posting my data for verification. I have a simple login form using AngularJS. I am trying to post this data for verification to Spring. But my URL doesn't go to my String controller.

This is my angularjs controller code from where I am trying to call my Spring Controller:



My String Controller:



My web.xml:



There is no error on server but the data is not getting validated and the form gets refreshed. Please help

Update:

I tried checking the data through postmaster. My spring part works fine because it shows correct response for the sample JSON data I entered. So, the problem is with angularjs controller. I tried debugging this using firebug. The angularjs controller loads but the login method is not called. Kindly suggest.
 
Stephan van Hulst
Bartender
Posts: 6654
90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you used your browser's developer tools to check out what requests are being sent, to where, and what the response is?
 
kuhu vora
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used firebug to see the errors. There were no errors there. Also, I placed a alert in the angularjs controller which is being called. I also have a info statement in the Spring controller but this statement is not called. Can you please specify what else can I use to check? Sorry for this basic question
 
kuhu vora
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used firebug to see the errors. There were no errors there. Also, I placed a alert in the angularjs controller which is being called. I also have a info statement in the Spring controller but this statement is not called. I tried using postmaster too which I am not familiar with. The request status comes out as 200(OK) but I couldn't see any JSON. I included the screenshot here.
Capture.PNG
[Thumbnail for Capture.PNG]
 
kuhu vora
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Update:

I tried checking the data through postmaster. My spring part works fine because it shows correct response for the sample JSON data I entered. So, the problem is with angularjs controller. I tried debugging this using firebug. The angularjs controller loads but the login method is not called. Kindly suggest.
 
kuhu vora
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought .fields was some angular thing to change form data to json. Anyways, I changed my request data in the controller:



Now, the request goes fine and gets code 200 but the response is bad. I can see the correct response in the browser tool but there is some problem parsing it.


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!