Hi all,
Im writing a servlet to communicate to the Gateway..I'll explain it with the code
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { /* Initial Declarations for all the values that are * necessary... * It has to be present or the catch blok will execute to * result in errors. */ String query_string = new String(); String and_split[] = new String[15]; String equal_splt = new String(); String host_no[] = new String[3]; String dest_no[] = new String[3]; String med_code[] = new String[3]; String sys_time[] = new String[3]; res.setContentType("text/html"); query_string = req.getQueryString(); try { and_split = query_string.split("&"); if (and_split.length == 4) { String send_no = and_split[0].toString(); String rec_no = and_split[1].toString(); String code = and_split[2].toString(); String time = and_split[3].toString(); host_no = and_split[0].toString().split("="); dest_no = and_split[0].toString().split("="); med_code = and_split[0].toString().split("="); sys_time = and_split[0].toString().split("="); } } catch (NullPointerException e) { System.out.println("error"); } handle_db(host_no, dest_no, med_code, sys_time); }
--> My first one is(Coming from ruby, after the .split("&") i converted the resulting array with .toString() as i needed to further split it)
That didnt work.
--> Secondly this is the get request.. Now
---> the doGet() forwards the values to a function called handle_db() that does further processing...public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { }
----> This generates a value(Single value)
----> How do i post this value back to the Gateway?
eg, (Supposing the gateway url is ; www.testgateway.com/somepath)
how do i post the data back to that particular url... Secondly.. How do i construct the url..)
Im so far familiar with POST using forms.. But now this has to be done through url...
Dont have much idea can anyone please help.
Thanks