wood burning stoves 2.0*
The moose likes Servlets and the fly likes URLs and appending parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "URLs and appending parameters" Watch "URLs and appending parameters" New topic
Author

URLs and appending parameters

Nicole Jones
Greenhorn

Joined: Mar 18, 2011
Posts: 21
Is it possible to pick and choose what parameters to show and what parameters to not show in a URL?

I have a controller servlet that forwards the request/response to other servlets depending upon one given parameter.

Here is a snippet of code for the controller servlet:


In the other servlets, there is an array of a parameter. What I don't want is the "arrayed" parameter to be appended to the URL. example: http://localhost:8080/myApp/exportData?type=pdf?customerId=1?customerId=2?customerId=3

Here is a snippet of code for the "other" servlet:


I want the controller servlet to list the one parameter in the URL. example: http://localhost:8080/myApp/exportData?type=pdf INSTEAD OF http://localhost:8080/myApp/exportData?type=pdf?customerId=1?customerId=2?customerId=3. Is this possible?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61094
    
  66

A forward does not create a new request. The request, and all its parameters, is the same for the original servlet as well as the one to which it is forwarded.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Nicole Jones
Greenhorn

Joined: Mar 18, 2011
Posts: 21
Bear Bibeault wrote:A forward does not create a new request. The request, and all its parameters, is the same for the original servlet as well as the one to which it is forwarded.


Thanks. I'm going to try to use redirects w/ session attributes.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61094
    
  66

Why? What's wrong with the forward? just ignore any parameters you are not interested in.
Nicole Jones
Greenhorn

Joined: Mar 18, 2011
Posts: 21
what do you mean? are you referencing filters and/or wrappers? if so, too messy.

Bear Bibeault wrote:Why? What's wrong with the forward? just ignore any parameters you are not interested in.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61094
    
  66

Who said anything about filters and wrappers?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URLs and appending parameters