• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

RequestDispatch Forward and Include

 
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am unit testing (with the help of Cactus framework) my servlet which contains the line RequestDispatcher.forward(..). In short, I need to manually instantiates my servlet and calls its doGet() with the request/response provided by the framework and verify the required attributes are put in the request when the servlet returns.

However, that comes to the question of what RequestDispatcher.forward() would do to my execution flow. Normally, we're not expected to put in any code after forward(). But in unit testing, our verification would be placed after the servlet call. I checked the API & servlet spec. There is nothing about the execution flow after forward() call. Can anyone clarify on this? Thanks a lot.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this goes beyong the scope of unit testing. It is the container's responsability to leave the request parameters after the forward. If you want to check that parameters are in the request, do it before the forward.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic