aspose file tools*
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
Author

[S2] IncludeParams with s:url Tag

David Zazeky
Greenhorn

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.

Thanks!
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>

HTH.


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [S2] IncludeParams with s:url Tag