wood burning stoves 2.0*
The moose likes Testing and the fly likes Testing a servlet with a URL and parameter list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Testing a servlet with a URL and parameter list" Watch "Testing a servlet with a URL and parameter list" New topic
Author

Testing a servlet with a URL and parameter list

Mike Tabak
Ranch Hand

Joined: Mar 31, 2012
Posts: 45
I want to test a Servlet which has a doPost and doGet method. The servlet receives 2 strings from the request object and Parameter values from a list box. Here is the relevent doPost code:



Note the loop towards the bottom that retrieves the selectedMusic strings. This servlet is mapped to "displayMusicChoices" on my tomcat server. I would like to test this via a browser using a URL and parameters. When I enter

http://localhost:8080/Ch06email/displayMusicList?string1=firstName&string2=lastName&musiclist=Folk

I get:

Thank you for joining our email list Michael Tabak.


We'll email you whenever we have new releases for
these types of music:

Folk


How can I modify the above http://localhost:8080...... request so I can see more than one music choice (the available ones are Folk, Country, Bluegrass and Rock)?

Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8



for example.
Mike Tabak
Ranch Hand

Joined: Mar 31, 2012
Posts: 45
Thanks, I tried that and it didn't work the first time, but this time it did, must have had an error in my URL.
 
Consider Paul's rocket mass heater.
 
subject: Testing a servlet with a URL and parameter list