It's not a secret anymore!
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
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Reply 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: 32
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: 16483
    
    2



for example.
Mike Tabak
Ranch Hand

Joined: Mar 31, 2012
Posts: 32
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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Testing a servlet with a URL and parameter list
 
Similar Threads
List Box problem
EL and quotes (HFSJ pg373)
Servlet getting values from a combo box
Unable to understand the solution on EL
Passing values from JSP