aspose file tools*
The moose likes JSP and the fly likes Accessing a servlet from a Struts App running in another context. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Accessing a servlet from a Struts App running in another context." Watch "Accessing a servlet from a Struts App running in another context." New topic
Author

Accessing a servlet from a Struts App running in another context.

Tomson Antony
Greenhorn

Joined: Nov 25, 2002
Posts: 3
HI,
I want to access a servlet which is running in another context from a struts application which is running in a different context.Whether it is possible? And how we can access a doPost () method of the servlet from a Struts Action class?
Please advise me
Thanks in advance.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I answered a similar problem to the context problem in this thread here.
[ December 12, 2002: Message edited by: David O'Meara ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Emailed by Tomson Antony
Thanks for your reply.
But i would like to explain the whole scenario.
I am using struts application through which i am contacting the ejbs in the app server.
The requirement is that i want to write a file which has been uploaded by the client to the m/c where app server is running. Suppose my web container ie, struts appl. is running in another m/c. Since ejbs doesnot sopport file I/O operation, I've developed a servlet instead in the app server. If i am accessing the servlet directly from the submit form, im violating the mvc rule, which i dont want. So the scenario is that i want to send a file object or a multipart request to that servlet. I got some idea from other resources that, to open a URLConnection.
But i dont know how i can send a multipart request.
Hope u'll provide me with some idea. Sorry for a lengthy mail.And thaks for your help.
regards,
Tomson Antony

I think I understand your current situation, and you can solve it by sending a multipart request from the web server to the application server.
The format of a multipart request including an upload file has been discussed before, I'll go have a look for that thread...
Dave
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

This thread from the JSP forum discussed how to open a socket and write your own mutipart request to a servlet.
Hope this helps,
Dave.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing a servlet from a Struts App running in another context.