Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

forward request to struts action on other server

Status
Not open for further replies.

bramsomers

Programmer
Dec 8, 2006
5
0
0
BE
Hi all,

I have two servers, each running the sun appliction server (9.0). I've build a webapplication, and know I want to forward requests from the first to the second application server.

In my LoginAction on the first server I put this in the code:

return new ActionForward(" + server.getUrl() + ":8080/project/Login.do", false);

put that gives me the error:
java.lang.IllegalArgumentException: Path does not start with a "/" character

I don't know what I do wrong, does anybody know a way to do this?

It need to be forwarded, so that the action on the other server can access the parameters in the form.

Thanks a lot!

Bram
 
Hi

Forwarding is passing forward the data to another class for further processing. You can not forward outside the server. You can only redirect.
Code:
return new ActionForward("[URL unfurl="true"]http://"[/URL] + server.getUrl() + ":8080/project/Login.do", [red]true[/red]);
Note that you can not pass the [tt]ActionForm[/tt] and other information that way.

Feherke.
 
and is there any other solution to pass the parameters?
 
Hi,

Thank you for your reply.
I was wondering if you could give me an example or something. Because I can't get it to work like I want. I can make a connection to the other server and post the parameters to it, that's not a problem, but struts needs a mapping return, what do I need to return for server one, so the browser shows the results of the action processed by server 2?

Thanks,
Bram
 
Hi,

I will explain my problem again, with a few more details.
I have the following code now:
Code:
ActionRedirect redirect = new ActionRedirect();
redirect.addParameter("title", newArticleActionForm.getTitle());
                redirect.addParameter("date", newArticleActionForm.getDate());
                redirect.addParameter("author", newArticleActionForm.getAuthor());
                redirect.addParameter("keywords", newArticleActionForm.getKeywords());
                redirect.addParameter("text", newArticleActionForm.getText());
                redirect.setPath("[URL unfurl="true"]http://"[/URL] + server.getUrl() + ":8080/ElectronicNewsPaper-war/NewArticle.do");
                redirect.setRedirect(true);
                //invalidate session on forwarding server
                session.invalidate();
                return redirect;
as you can see, the parameters are passed by GET, now I've searched for a solution like this for struts, but... I want the parameters be passed by POST...

Bram
 
Hi,

Yeah, I know, but... I'm searching for a forward solution for struts...

Thanks,
Bram
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top