File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
 
 
subject: [S2] IncludeParams with s:url Tag
 
Similar Threads
Struts2: s:param not adding parameters to s:url
Struts 2 s:url and s:param tag question
Highlight corresponding row after Return button press
Proble with <interceptor-ref name="execAndWait"/>
Pass parameters to Model from anchor tag