1

In my jsp page, there is link as follows.

<s:url var="editReqDetails" action="editReqDetails">
   <s:param name="siteID" value="siteId"/>
</s:url>

when I click on that link, browser URL is

http://localhost:7101/legal/editReqDetails?siteID=99

like above.(The parameter shows in the URL.)

I want to know how to hide above highlighted part(the parameter) from the url.

Tomás
  • 59
  • 10
lpushpe
  • 63
  • 1
  • 2
  • 6

3 Answers3

0

If you can use javascript you could do this

<s:a href="#" onclick="window.location.href='%{editReqDetails}'">Edit Details</s:a>

This way you "hide" the url from the user. Though I'm not sure what the big problem is. If the user is malicious he can easily look in the source and get the values.

Liviu T.
  • 23,204
  • 10
  • 60
  • 58
0

No, you can't use this. You pass parameter with http GET method that is default used in s:url tag and you want to get http POST method behavior. See the usage of struts url and choose one http GET or POST method.

Sai Ye Yan Naing Aye
  • 6,218
  • 10
  • 42
  • 63
  • Did u suggest to use **includeParams="none"** ? I try it but still parameters include in the URL. – lpushpe Aug 14 '12 at 12:38
0

You can do this:

<form id="edit-form" action="editReqDetails" method="POST">
    <input type="hidden" name="siteID" value="siteId" />
</form>

Then:

<script type="text/javascript">
    $(document).ready(function() {
        $("#your-link").click(function(e) {
            $("#edit-form").submit();
        });
    }); 
</script>
Tomás
  • 59
  • 10