JSP help needed

Status
Not open for further replies.

random2

Inactive
Galvanizer
Hi all,

Im not a JSP/Java programmer, but need a pretty simple fix on a app built on JSP.

The JSP page is a form processor and in between the workflow, I need to call a URL (its just RESTful API).

1. How do I call a URL?(I dont want to see any response as exception is handled well on the other end). Any pointers on url retrieval, GET, POST things would be helpful

2. Could you please point me to some basic string operation examples/tuts which could help me in url building.

Thanks in advance,
Deepak
 
1. You can use the standard html form to submit the form. Use the ACTION attribute of form to give the destination URL along with the METHOD(Get/Put) attribute.

Eg:

<FORM ACTION="destination_url" METHOD=PUT>

</FORM>

2. You can use the StringBuffer class (assuming you need a dynamic URL) to create the URL and when the URL is ready, use the URLEncoder.encode() method to encode the URL.

StringBuffer (Java 2 Platform SE 5.0)

URLEncoder (Java 2 Platform SE 5.0)
 
Status
Not open for further replies.