我可以在两个web应用程序之间的jsp中重定向吗? [英] can i redirect in jsp between 2 web app?

查看:151
本文介绍了我可以在两个web应用程序之间的jsp中重定向吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我有两个网络应用程序在同一个工作空间
我如何从第一个webb应用程序中的页面重定向到第二个网络应用程序?



在一个webb应用程序中,我使用:

  RequestDispatcher req = request.getRequestDispatcher(vote.jsp); 
req.forward(请求,响应);

如果会话不开启,我想重定向,所以我不能使用

 < META HTTP-EQUIV =刷新CONTENT =0; URL = / test //> 

我需要一些东西,如 RequestDispatcher / p>

解决方案

我的朋友这样做:

  {out.println(Si votre navigateur ne support pas la redirectirection automatique< a href ='http:// localhost:8080 / HiberBarti / JSP / session / index.jsp'>点击Ic< / a> ;); 

String url =http:// localhost:8080 / HiberBarti / JSP / session / index.jsp;
// encodeRedirectURL(url);
// sendRedirect(url);
response.sendRedirect(response.encodeRedirectURL(url));
}


Hello i have 2 web app in the same worke space How can i redirect from page in the 1st webb app to the 2nd web app ?

in one webb app i use :

 RequestDispatcher req =request.getRequestDispatcher("vote.jsp");
req.forward(request, response);

i want redirect if the session is not open so i can't use that

<META HTTP-EQUIV="Refresh" CONTENT="0; URL=/test/"/> 

i need some thing like the RequestDispatcher

解决方案

My friend do like that :

{out.println("Si votre navigateur ne support pas la redirection automatique <a href='http://localhost:8080/HiberBarti/JSP/session/index.jsp'> Click Ic</a>");

String url ="http://localhost:8080/HiberBarti/JSP/session/index.jsp";
//encodeRedirectURL(url);
//sendRedirect(url);
response.sendRedirect(response.encodeRedirectURL(url));
}

这篇关于我可以在两个web应用程序之间的jsp中重定向吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆