wood burning stoves 2.0*
The moose likes Struts and the fly likes Get result page from remote struts action call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Get result page from remote struts action call" Watch "Get result page from remote struts action call" New topic
Author

Get result page from remote struts action call

Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
I asked a similar question in another forum but now I think it is related to struts. If I have an existing web application, and I developed a new struts application in a separate .ear. On a page of the existing web application, can I make a link using complete URL to call the new struts application action and let the action return a JSP result page, then I append that JSP page to the current page (current page is in the scope of existing application) ? I don't know if this idea works, I know a action path call can take you to some new page, but here I am sort of looking to get the result page back from struts and plug in to the current EAR's web page. Does it work ?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Ajax.

Back-end technology isn't relevant.
Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
David Newton wrote:Ajax.

Back-end technology isn't relevant.


Thanks. I don't know Ajax. Do you mean Ajax can do this ?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Yes.
Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
David Newton wrote:Yes.


If We don't use Ajax, does it work ? for instance, can I just invoke the new struts application and append its JSP to the exisiting application's page without using Ajax. I want to know if this mechanism works. Thanks.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I *guess* you could use HttpClient or the equivalent to do this.

Seems like a really, really horrible idea.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Maybe the <c:import> tag? I don't recall how it works.

In any case--this still isn't a Struts question.
Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
David Newton wrote:Maybe the <c:import> tag? I don't recall how it works.

In any case--this still isn't a Struts question.


Thanks David for your information. You said couple of times this is not a struts issue. Let's assume <c:import...> works in the <c:import> tag's URL part I give
the url for this struts action. My question is ---

In struts.xml file, I can still simply do

<action name="..." class=".." method="..">
<result name="success" >success.jsp</result>
<result name="failure" >failure.jsp</result>
</action>

if it succeeds, remote application gets "success.jsp" otherwise gets "failure.jsp".

Correct ?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The back end does not care how the request is made, or where it comes from.
Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
David Newton wrote:The back end does not care how the request is made, or where it comes from.


I think I understand the meaning of your sentence. But I am not smart enough to inference out the second half ---- So, is the approach I said in my last thread correct ??
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Are you basically asking how to configure Struts 2 results?
Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
David Newton wrote:Are you basically asking how to configure Struts 2 results?


My question was indeed confusing, I know... Even myself is confused when I look at it again.
I was not asking the basic struts setting. I was just not feeling confident that kind setting would work for this type approach. I thought sometimes from one action we can set it to redirect another action, and so on, eventually to a JSP. So I was not sure finally the application that calls the struts will get the JSP. I was just not confident (or stupid), now I think it should be fine. No matter how many layers of forwarding, as long as it finally forward to a JSP, the calling end will get the JSP.

Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Get result page from remote struts action call