I am trying to forward the page using absolute URL. The problem is it is appending the "/" infront of
http://xxx.com/test1.jsp i.e if the url becomes /http://xxx.com/xyz/test1.jsp if use forward tag in jsp.
Why is that forward slash ("/") appending to the URL?
Please can any one know why I have this problem.
Here is the code I am using:
<jsp:forward page='http://xxx.com/xyz/test1.jsp' />
According to the jsp spec...
The <jsp:forward> element forwards the request object containing the client request information from one JSP page to another resource. The target resource can be an HTML file, another JSP page, or a servlet, as long as it is in the same application context as the forwarding JSP page.
So if xyz is the web app of test.jsp, you can forward to test1.jsp with
<jsp:forward page="test1.jsp" />, and the slash gets prepended to your 'goto' page.
If test1.jsp is in another web app, I think you're out of luck with jsp:forward - try c:inport instead if that is available to you.
Here is my problem:
I need to forward jsp page to read CGI Report which is running on same server (the folder of jsp pages and CGI pages are diff on the same server).
I don't have any control on CGI page. If I use response.sendRedirect() method works fine but the problem is if I copy that CGI report URL from current browser to new browser it still works. My prob is it should not work when user copy the URL from current browser to new browser. ( I don't have any control on CGI report). Why I am trying to use forward is user can't see the URL in browser.
How can I solve my problem?
Any help please... I am struggling lot with this.
1) Embed the CGI-produced page within a jsp. You need to have JSTL available to do this.
<c:import page="http://xxx.com/xyz/test1.jsp" />
2) Use response.sendRedirect(), but send it to some CGI component that you don't mind people seeing the address for, & get that component to pass the request on to 'test1.jsp'. I don't know how feasible this is though.
Here's a page with some code showing usage of c:import