• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Removing HttpServletRequest parameters

 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I remove the request parameters?

I have this situation:
1- The login page collect the userName and password.
2- The login page send the info. to LoginAction.
3- if authinticated, the LoginAction forward to ResourceAction
4- ResourceAction does some business logic, and forward to resroucePage.
5- ResourcePage uses DisplayTag to display the resources, and adds export links in the buttom.

When I looked at at the source of the html generated by ResourcePage, I was surprised to find out that the links generated by the displayTag adds the userName and password to the links.

Here is a link:
<a href="/MyApp/resources.do?password=password&action=preSelect&action=login&action=select&loginName=
admin&6578706f7274=1&d-49653-e=1"><span class="export csv">CSV </span></a>

The request is not cleared after it is being forward from one action to another. I don't want the loginName nor the password to hang in the request.

How can I remove them?

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't. But you really don't need to.

Firstly, use a POST rather than a GET and the params will not appear on the URL.

Secondly, you should become familiar with the PRG (Post-Redirect-Get) pattern. This article might be helpful.
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
You can't. But you really don't need to.

Firstly, use a POST rather than a GET and the params will not appear on the URL.

Secondly, you should become familiar with the PRG (Post-Redirect-Get) pattern. This article might be helpful.


I am already using 'post' method in my form. I don't know how PRG is related to my problem. I am using Struts for forwards.
 
rahul khanna
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using 'Post' it should not happen .. can you paste your code here. it would help to narrow it down
 
Sunny Gibbony
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can paste your code in http://pastebin.com/ where it can be modified by us.
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my login form:

<html:form action="/login" method="POST" >
<html:hidden name="loginForm" property="action" value="login" />

<b> Login Name:</b>
<html:text name="loginForm" property="loginName" maxlength="20" size="20" />
<br>
<br>
<b>Password:</b>
<html assword name="loginForm" property="password" maxlength="20" size="20" />
<br>
<br>
<html:submit value="Login" />
</html:form>

In the following page (also is POST), displayTag append the loginName and password to the request parameters list this:

<a href="/MyApp/resources.do?password=password&action=preSelect&action=login&action=select&loginName=
admin&6578706f7274=1&d-49653-e=1"><span class="export csv">CSV </span></a>
[ May 16, 2008: Message edited by: Hanna Habashy ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic