英文:
Redirecting to another JSP page in JSP
问题
<td><button name="button" value="OK" type="button" onclick="document.location.href='../JSP/DownloadReport.jsp';">点击这里</button> </td>
英文:
<td><button name="button" value="OK" type="button" onclick="document.location.href='../JSP/DownloadReport.jsp';">Click Here</button> </td>
I have a jsp page in folder D:\workspace\Report\WebContent\retrievedata.jsp in which i used button tag.
now from this button i want to redirect to page which is another folder D:\workspace\Report\WebContent\JSP\DownloadReport.
how can i do that?
答案1
得分: 1
你可以使用更传统的方法。
<a href="./JSP/DownloadReport.jsp">
<button name="button" value="OK" type="button">点击这里</button>
</a>
英文:
You could use the more traditional way.
<a href="./JSP/DownloadReport.jsp">
<button name="button" value="OK" type="button">Click Here</button>
</a>
答案2
得分: 1
从路径中删除../
,即您必须使用如下所示的路径:
<button name="button" value="OK" type="button" onclick="document.location.href='JSP/DownloadReport.jsp';">
这是因为路径JSP/
是相对于retrievedata.jsp
的路径。
英文:
Remove ../
from your path i.e. you have to use the path as shown below:
<button name="button" value="OK" type="button" onclick="document.location.href='JSP/DownloadReport.jsp';">
It is because the path, JSP/
is relative to the path of retrievedata.jsp
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论