通过超链接隐藏值

发布于 2024-12-27 08:33:47 字数 446 浏览 1 评论 0原文

我问:每当我通过链接传递一个值时,它看起来像这样:

<a href="some.jsp?someid=<%=something%>">Click here to view details</a>

现在,当我单击该超链接时,我将转到 some.jsp 并检索搜索值,例如:

request.getparameter("someid"); 

但我还在浏览器 URL 中看到了所有这些敏感细节,这些细节很容易受到攻击。我想隐藏所有这些详细信息,以便浏览器的网址中不会显示任何内容,但处理将在内部完成。我该怎么做?请忽略 jsp 标签,我正在学习 JSTL,很快就会替换 scriplet,但最初我想在 jsp 标签上实现它。非常感谢任何帮助。

I was asking that : whenever I pass a value by a link then it looks like this:

<a href="some.jsp?someid=<%=something%>">Click here to view details</a>

Now when i click on that hyperlink i am going to some.jsp and retrieving value of search like:

request.getparameter("someid"); 

But I am also seeing all those sensitive details in the browser URL, which is vulnerable. I want to hide all these details so that nothing will be shown in the browser's url but processing will be done internally. How can i do it? Please ignore jsp tags, I am learning JSTL and will soon replace scriplets but initially i want to implement it on jsp tags. Any help is much appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

淡淡绿茶香 2025-01-03 08:33:47

如果您要将链接转换为按钮,您可以将其作为隐藏的 POST 值传递,并让您的 some.jsp 页面读取该值。例如:

<form method="post" action="some.jsp">
    <input type="hidden" name="someid" value="<%=something%>" />
    <input type="submit" value="Click here to view details" />
</form>

然后在您的 some.jsp 上,您可以读取 someid POST 值并对其进行任何您想要的操作。

If you'd turn the link into a button you could pass it as a hidden POST value and have your some.jsp page read that. For example:

<form method="post" action="some.jsp">
    <input type="hidden" name="someid" value="<%=something%>" />
    <input type="submit" value="Click here to view details" />
</form>

Then on your some.jsp, you can read the someid POST value and do with that whatever you want.

想你只要分分秒秒 2025-01-03 08:33:47

首先,如果你想在 URL 中显示敏感内容,为什么要使用 GET 请求。
您应该使用 POST 请求。将 someid 的值存储在请求属性中。

First of all , if you want to show sensitives stuffs in URL, Why are you usng GET request.
You should use POST request. Store the value of someid in request attribute.

他夏了夏天 2025-01-03 08:33:47

您可以加密和解密 someid 的值来执行此操作。请参阅此处给出的示例:
使用 DES 加密字符串

You can encrypt and decrypt the value of someid for doing it. See the example given here:
Encrypting a String with DES

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文