• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 action to Struts 1 action

 
Ram ank
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9312
10
Linux Mac OS X Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ram ank
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That worked Thank You. I thought if i give only relative path it would call on local server but it don't.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic