【问题标题】:to know which link is clicked in the previous page using jsp使用jsp知道上一页点击了哪个链接
【发布时间】:2014-04-05 18:44:34
【问题描述】:

jsp代码知道上一页点击了哪个链接, 在此基础上更改第二页的网页内容。 帮我写代码。

【问题讨论】:

  • 只需将最后点击的链接附加到查询字符串。 <a href="biography?lastclicked=contact"></a>

标签: javascript jsp servlets jstl


【解决方案1】:

假设所有链接都有一个 JSP,请执行以下操作:

ma​​in.jsp:

<ul>
  <li><a href="detail.jsp?link=page1">Page 1</a></li>
  <li><a href="detail.jsp?link=page2">Page 2</a></li>
</ul>

detail.jsp:

<h1>I am on Detail Page</h1>
<% String link = request.getParameter("link"); %>

然后根据需要使用此变量。

【讨论】:

    猜你喜欢
    • 2017-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-03
    • 1970-01-01
    • 2012-04-17
    相关资源
    最近更新 更多