开发者

Calling a webpage from another webpage via jsp

I am trying to figure out how to do the following.

I have webpage at a certian location called www.hello.com/logout.jsp

What I am trying to do with logout.jsp is delete all the cookies that were stored when initially logging in. The problem is that there exists a coo开发者_Go百科kie for a website with a different domain that is stored when logging in. The one way I can delete that cookie is through the logout link for that website e.g. www.hello2.com/logout.jsp

Is there anyway I can call www.hello2.com/logout.jsp from www.hello.com/logout.jsp? I am trying to just make a call for www.hello2.com/logout.jsp from www.hello.com/logout.jsp and then redirect the user to another page on www.hello.com

Thanks in advance :D


If I understand correctly, you are trying to do an HTTP POST( or GET ) to www.hello2.com/logout.jsp while processing HTTP request to your web application's logout.jsp.

You should really consider coding your logic in Servlets and using JSPs only to present data, but in the meantime you can create a scriptlet inside your logout.jsp and do a call to another web page in there ( just don't code the whole thing in JSP, only make a call to a static method ).

In that static method you can use HttpClient to do whatever HTTP request you need from www.hello2.com.

Here are additions to your logout.jsp

<%@ page import="my.package.Hello2Call" %>

<%
    Hello2Call.postLogoutRequest( );
%>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜