File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes [S2] IncludeParams with s:url Tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "[S2] IncludeParams with s:url Tag" Watch "[S2] IncludeParams with s:url Tag" New topic

[S2] IncludeParams with s:url Tag

David Zazeky

Joined: Nov 05, 2008
Posts: 7
I have two actions: searchResults and searchForm. I am trying to create a link from searchResults back to the searchForm while passing all of the user's search parameters. To do that, I tried using the s:url tag with includeParams="all." The problem is that the resulting link takes me back to searchResults instead of going to searchForm (even though I specified searchForm in the action tag).

My JSP code:

The resulting URL generated (parameters omitted):

Does anyone know how to stop Struts from including the "action:searchResults=searchForm" part in the URL? The generated link works correctly if I manually delete that part of the link.

Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

There is nothing wrong with the code. My guess is that the extra parameters are present in the first request to searchResults action, and then they get added to the generated link since you are using includeParams="all".

Check if you are submitting these parameters through query string or a form submission when the searchResult action is invoked the first time.
If yes, then the solution is to either remove those parameters, or use includeParams='get' if that serves your purpose. Otherwise, you may have to fall back to setting includeParams='none' and adding the required parameters manually using <s:param>


The future is here. It's just not evenly distributed yet. - William Gibson
Sonny Gill LinkedIn
I agree. Here's the link:
subject: [S2] IncludeParams with s:url Tag
It's not a secret anymore!