tags:

views:

43

answers:

2

How to call REST API when html form is submitted?

- basically i want to use @FormParam, ne example of tht will also do..!

A: 

have a look at this

Vinay Pandey
This is not wht I want to know, it is all about writing client for calling REST URI's.
Parag
A: 

As far as I understand what you are asking is Obviously what you ask is for is not even about java. If i'm correct, what you want to do is generate some html form from a jsp, and on submitting that form, submit it to a rest service.

So basically, you should be looking at how to write a javascript to do that. Write some javascript to trigger on form submit, which would post the form to the rest service. (it will be easy if the rest service communicates with json because javascript loves json)

Roshan Amadoru
What's wrong with the POST that the HTML form does? Why do you need JS?
Darrel Miller
oh hell.. well. yeah, you don't need JS at all. Just set the target of the form to the rest service and it should be good to go.. What I was initially having in mind is that mainly rest services comes with authentication requirements and what not. So that's why i have suggested JS. But reading again, JS is not required at all for this use case.
Roshan Amadoru