This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I had created a simple java class to call a simple servlet without any error however the servlet do not have any display(suppose my servlet will display output to Tomcat console for every invokement). Could anyone could explain this issue ???
Following is my JAVA class
For Servlet side, I had configure the web.xml with follow
In the deployment descriptor, you must also include a <servlet> tag, which allows you to specify the fully-qualified class name of the servlet. You have only posted the <servlet-mapping> tag in your forum post.
In order to actually send the HTTP request using the URLConnection class, I think that you have to call getInputStream(). This will send the request and allow you to access the body of the response.
Also, I see that you are setting the request's content type...since you are not putting anything in the request body, you do not need to do this. The servlet will still accept your request just fine.
In addition, you should not be overriding init(ServletConfig). The method you should override is init().