A servlet cannot print for a client for 3 reasons:
1. A servlet is built on HTTP, and HTTP can only respond to requests. If the browser makes a request, the response will go to the browser, so the browser would have to then route the output to a printer (more on this shortly). A printer doesn't make HTTP requests, so until someone invents one that can
2. The whole infrastructure of web client and web server is designed to sandbox out automated printing because believe it or not, people have using print subsystems to do rude, evil and abusive things.
3. The servlet doesn't know what the client's printing options are (what, if any printers are available and what drivers and print options to use).
A web client can print directly if it contains an applet that prints, but do to sandbox rules, this requires that the applet be digitally signed and that the client machine is set up to accept it. This is usually more trouble than it's worth.
An IDE is no substitute for an Intelligent Developer.
Joined: May 09, 2008
thanks for the reply,
can you please send the sample code to send data from browser to HP printer. or send me the link where i can find more information about this. please i am new to this topic.