重定向到另一个 JSP 页面在 JSP 中。

huangapple go评论64阅读模式
英文:

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:

&lt;button name=&quot;button&quot; value=&quot;OK&quot; type=&quot;button&quot; onclick=&quot;document.location.href=&#39;JSP/DownloadReport.jsp&#39;;&quot;&gt;

It is because the path, JSP/ is relative to the path of retrievedata.jsp.

huangapple
  • 本文由 发表于 2020年9月28日 17:09:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/64099146.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定