This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
You can contact a JSP by invoking the _jspService method. But, realize that this takes the HttpSerlvetRequest and HttpServletResponse as parameters.
Instead, you can use an API like HttpUnit to create a request object and invoke the JSP through that. It also give you the ability to receive the response. Check out the HttpUnit website for more information and usage, especially the HttpUnit Cookbook [ April 22, 2002: Message edited by: Jessica Sant ]
Originally posted by Hemal Mehta: Whya can't we use Class URLConnection for this issue?
As far as I know, you should. HttpUnit was designed for unit testing. The only reason I can think of for using something external to the basic JDK would be if HttpURLConnection wasn't providing some of the side protocols, and in the case of Applets, at least, even the cookies are taken care of by HttpURLConnection. Just a quick look over HttpUnit gives me the impression that the extras that HttpUnit provides are for easing the composition and decomposition of HTML, XML, or other content. It's very likely that HttpUnit relies on HttpURLConnection itself. I think _jspService, BTW is the name some JSP compilers give the internal entry into the compiled JSP - you'd only really want to call that yourself if you're short-circuiting the servlet container and locally calling into the JSP.
An IDE is no substitute for an Intelligent Developer.