i have created one hyperlink, and by clicking on that i am redirecting the page to another JSP, but i am not getting the correct URL that i am passing, URL is appended with another string and the page is not redirected,
please anybody have any idea about that, help me out
<td align='<%=lstrColAlign%>' class="<%=tdclass%> Label2"
style="<%=rb.getDataStyleString(rvo,data)%>">
<a href="#" onclick="JavaScript:window.open( '<%=columnUrl%>','newwindow','top=0, left=0,
scrollbars=yes,status=1,resizable=yes,height= (screen.availHeight - 10),
width= (screen.availWidth-5)')"> <%=rb.getDataValue(data)%></a>
</font></td>
where i should get
...Project1-context-root/servlet/Reports.controller.ReportController?ActionFlag=get.............
but instead of that i am getting
...Project1-context-root/servlet/servlet/Reports.controller.ReportController?ActionFlag=get.....
so, extra word servlet/
is appended
Relative URL's without a leading slash are relative to the current context. Ie if the current URL in the browser address bar is http://example.com/context/index.jsp
and the relative URL to be opened from the current context is context/page.jsp
, then the final URL would be http://example.com/context/context/page.jsp
.
There are several ways to fix this:
page.jsp
. /context/page.jsp
. http://example.com/context/page.jsp
. ../context/page.jsp
. It works all the same way as with disk filesystem paths.
It seems like your <%=columnUrl> variable is getting
servlet/Reports.controller.ReportController?ActionFlag=get.....
And from your calling JSP, it's appending context path automatically..
Debug your columnUrl variable first and change that variable value to relative by updating it to ../context/page.jsp should works for you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.