aspose file tools
The moose likes Struts and the fly likes Struts 2 action to Struts 1 action Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Struts 2 action to Struts 1 action" Watch "Struts 2 action to Struts 1 action" New topic
Author

Struts 2 action to Struts 1 action

Ram ank
Greenhorn

Joined: Apr 28, 2011
Posts: 10
Hi,

I have two applications one running on struts 1 and other on struts 2. Now i need to call action in strtus 1 application from struts2 and parse the response.
I am using

URL url = new URL("/???/executeTestAction.do");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream());

writer.write(data);
writer.flush();

// Get the response
StringBuffer response = new StringBuffer();
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));

but i am getting error saying Error no protocol. I am not sure this is right way to connect or not.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8290

A URL starts with a protocol. You want to use HTTP, but a URL can also be used to access resources with other protocols like FTP, FILE, Gopher and many others.
Uniform Resource Locators (URL) RFC 1738


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Ram ank
Greenhorn

Joined: Apr 28, 2011
Posts: 10
That worked Thank You. I thought if i give only relative path it would call on local server but it don't.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Struts 2 action to Struts 1 action
 
Similar Threads
Servlet call another context
HttpUrlConnection - cXML PunchOutSetupRequest
how to wait my class for the servlet response
HTTPS POST using java.net
HttpURLConnection - Luanch Browser