• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

sensing submit in servlet

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a servlet with a blank action (so it calls itself). first time in it creates a form with a submit button a la:

so the servlet has basically this logic:

this works fine when i test it on my servlet engine.
the problem is trying to test it with httpUnit. when i submit the form via the httpUnit WebConversation getResponse method, the code above always hits the else block.
is there a better way to check for form submission than my req.getParameter("goButton") call? preferably one that httpUnit likes...
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTTPUnit is actually very good at simulating form submission, but I guess you are not using the form parsing and submission tools.
I suggest that you take a look at part 6 of my "small and simple web applications" series in the Java Ranch Journal. In this article I give some detailled instructions on how to test web applications using the HTTPUnit form tools.
 
john guthrie
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks. i'll try that out. you're right, i didn't use the same code. i had something like:

in other words, i used WebRequest instead of SubmitButton. it ran, but the submit button didn't seem to be set.
again, thanks. i am finding that there is thin documentation on httpUnit. of course, i missed your article, which is greatly appreciated!
 
When it is used for evil, then watch out! When it is used for good, then things are much nicer. Like this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
    Bookmark Topic Watch Topic
  • New Topic