Printing through servlet

When I use the window.print() Java script or browser's Print button, it
          prints the whole page that is viewed on the browser. I want to send only
          some specific data
          to be printed that is the result set from the database to be printed. How
          to print only specific data?.
          Thanks
          Madhu
          

You can't do that...imagine if every site that you visited started printing out paraphernalia and brochures for your reading pleasure. And in any case, what if the client doesn't have a printer? Or has multiple printers? You shouldn't attempt to do anything without the client's knowledge, always let them choose the action.
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://www.catb.org/~esr/faqs/smart-questions.html
----------------------------------------------------------------

Similar Messages

  • How can I see whatever I print through System.out.println in my servlets when I use iplanet 4.1

    how can I see whatever I print through System.out.println in my servlets when I use iplanet 4.1

    Hi Nitin,
    Look out the below link, Hope this helps you.
    http://knowledgebase.iplanet.com/ikb/kb/articles/4235.html
    http://knowledgebase.iplanet.com/ikb/kb/articles/4790.html
    http://knowledgebase.iplanet.com/ikb/kb/articles/4699.html
    Regards,
    Dakshin.
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support.

  • Not able to retrieve data from database through servlet

    Hi friends,
    I am trying to open a excel sheet through servlet. In this servlet i am retriving data from mssql database.I am not getting any error but no data is retrived
    i m also pasting the code here
    // Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
    // Jad home page: http://www.kpdus.com/jad.html
    // Decompiler options: packimports(3)
    // Source File Name:   EmployeeData.java
    import java.io.*;
    import java.sql.*;
    import javax.sql.*;
    import javax.servlet.ServletException;
    import javax.servlet.http.*;
    public class EmployeeData extends HttpServlet
        public EmployeeData()
        public void service(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
            throws ServletException, IOException
            httpservletresponse.setContentType("text/html");
            httpservletresponse.setHeader("Content-Type", "application/excel");
            httpservletresponse.setHeader("Content-Disposition", "filename=reports.xls");
            PrintWriter printwriter = httpservletresponse.getWriter();
            try
                javax.servlet.http.HttpSession httpsession = httpservletrequest.getSession(true);
                int i = 0;
             /*   Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
                Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:3413;DatabaseName=newreportsodbc", "reportuser", "cisco");*/
                String url="jdbc:odbc:newreportsodbc";
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
                Connection connection = DriverManager.getConnection("jdbc:odbc:newreportsodbc","reportuser","cisco");
                Statement statement = connection.createStatement();
                printwriter.println("<b><center><u> Search Results </u></center></b>");
                printwriter.print("<table><tr><th color=brown background-color=#fff000>  No.  </th>");
                printwriter.print("<th> DateTime      </th></tr></table>");
           ResultSet resultset = statement.executeQuery("SELECT * FROM t_Call_Type_Half_Hour");
                boolean flag;
                for(flag = false; resultset.next(); flag = true)
                    i++;
                    SerialNo = resultset.getString(2);
                    printwriter.print((new StringBuilder()).append("<table><tr><td> ").append(i).append("</td>").toString());
                    printwriter.print((new StringBuilder()).append("<td> ").append(SerialNo).append("</td></tr></table>").toString());
                if(!flag)
                    printwriter.println("<h1> No records selected </h1>");
            catch(Exception exception)
                System.out.println((new StringBuilder()).append("SQLException: ").append(exception).toString());
        static String empid1;
        static String empid;
        static String SerialNo;
        static String designation;
    }thanks in advance. i just feel there is something to be done with connection string.

    post the table format in SQL

  • Displaying Images through Servlets

    I am using Servletrunner utility to run my servlets. How can I display Images along with other HTML text, to the Browsers through Servlets?

    Print out the <img> tag. The URL you use may in turn reference another servlet that produces an image. You can look at the Java2D (and perhaps Java3D, if you want 3D images) to help you produce the images.

  • How do I set up the system to print 4x6 labels via paypal and ebay using a DYMO 4XL Thermal Label Printer (through airport)?

    We bought a DYMO Label Writer 4XL. We want to print thermal labels from our Mac and PC, wireless. The good thing is that I already have the printer set in the network and added on each of our computers (Mac and Windows 8). For printing regular labels you can use the Dymo software; for printing postage labels from ebay or paypal has been impossible.
    From ebay I even tried one label at the time but still did not work.  I sent the the print command from the mac-print-window, changing each of the settings (such as paper size) but did not work. Each time (no matter if you want to print one label only) it advances more than one lable.
    http://community.ebay.com/t5/Miscellaneous/Using-a-thermal-printer-for-eBay-labe ls-using-a-Mac/qaq-p/3135261 (post by stormshock)
    Through Paypal is a different story. It should be easy cause it seems the Zebra Driver in Paypal works with this DYMO. The issue is how to get the system to send the print command to the DYMO printer through the Zebra LP2488? please help! I know some people have succeded making all these work. What am I missing?
    http://www.amazon.com/review/R3E73A6ZX39ZZQ/ref=cm_cr_pr_cmt?ie=UTF8&ASIN=B002M1 LGJ4&linkCode=&nodeID=&tag=#wasThisHelpful

    To whomever is reading this post I just wanted to let you know I returned the Dymo 4XL. Their customer service is horrible. Technical support does not exist at all. The issue was extremely frustrating and time consuming. I do not recommend this thermal printer at all. Good luck finding one... if you do, please share.

  • Printing through a Windows computer.

    I'm working on a 1GHz Power Mac G4 desktop that is connected with Ethernet to a Linksys BEFW11S4 wireless router. The printer is connected to a Dell Dimension 4300 by USB. The question for me is, even though I can get the printer to show up in my printer search list, I can't get anything to print off of it. Does anyone know a possible solution? Any ideas would be greatly appreciated. If you have any questions about details or anything, just leave me a message. Thanks for your help!

    I have a Mac Mini running Leopard and I print through a Windows XP computer with printer sharing turned on. My printer is a Samsung ML-1710.
    The printer shows up in the network as expected, but initially I had a problem in which the job was sent, the printer spun up then stopped dead.
    I tracked the problem to the driver setting on the Mac, which had defaulted to Generic Postscript Printer. Since Leopard had no driver for the ML-1710, I got it from the Samsung website, installed it, and changed the print driver to the proper one. Then it worked fine.
    I guess the important thing is that you are running the correct driver for the printer, as unlike WinXP, it doesn't install a network printer driver for you.

  • Im on my schools wifi and I can usually print through wifi using my laptop. Can i do the same through iPad? Im not sure if its an air printer or not but everything is through wifi.

    I can usually print through the schools wifi using my laptop. Can i do the same using the iPad air? and if so how? Ive tried using the airprinter but it wouldnt load any printers. Usually I need to setup the printer through settings in my macbook. Can anyone help me how to do the same for my iPad?

    iOS AirPrint Printers  http://support.apple.com/kb/HT4356
    How to Print from Your iPad: Summary of Printer and Printing Options
    http://ipadacademy.com/2012/03/how-to-print-from-your-ipad-summary-of-printer-an d-printing-options
    Print from iPad / iPhone without AirPrint
    http://ipadhelp.com/ipad-help/print-from-ipad-iphone-without-airprint/
    How to Enable AirPrint on a Mac and Use Any Printer
    http://ipadhelp.com/ipad-help/how-to-use-airprint-with-any-printer/
    iPad Power: How to Print
    http://www.macworld.com/article/1160312/ipad_printing.html
    Check out these print apps for the iPad.
    Print Utility for iPad  ($3.99) http://itunes.apple.com/us/app/print-utility-for-ipad/id422858586?mt=8
    Print Agent Pro for iPad ($5.99) http://itunes.apple.com/us/app/print-agent-pro-for-ipad/id421782942?mt=8   Print Agent Pro can print to many non-AirPrint and non-wireless printers on your network, even if they are only connected to a Mac or PC via USB.
    FingerPrint turns any printer into an AirPrint printer
    http://reviews.cnet.com/8301-19512_7-57368414-233/fingerprint-turns-any-printer- into-an-airprint-printer/
     Cheers, Tom

  • Can't print through Time Capsule using Windows-operating computers

    I've just bought a time capsule 500GB and it's working fine. It backups my macbook every hour and I can easily print whatever file I want through my Canon iP1800 series, which is connect to WAN port of my time capsule.
    However, I have others 2 notebooks running windows, and I can't print from them wirelessly. I've installed the airport utility and Bonjour in both computers using the CD that came with my time capsule and I followed these instructions of an old topic here (_but it didn't work out_):
    “1. Make sure the printer is recognized by the base station.
    2. Select 'Add a new printer' in Windows
    3. Select 'Local Printer' in the dialog box (auto detect and install
    should be off), click next.
    4. Choose 'Create a new port' and "Standard TCP/IP Port'. Click next.
    5. For the printer IP address, enter the address of the base station 10.0.1.1. The port name will be filled automatically. Click next.
    6. For the device type, choose 'Hewlet Packard Jet Direct', then click Finish.
    Choose your printer from the list and follow the rest of the prompts to install and configure the driver.”
    Do someone have any idea to tell me what's happening? How can I fix this problem and have Mac and Windows laptops printing through my time capsule?
    Thanks

    When you installed bonjour did the Bonjour Print Wizard appear on your desktop? Or in the program menu?
    http://support.apple.com/kb/HT3052?viewlocale=en_US
    In my personal experience Bonjour sometimes doesn't install properly and doesn't appear on either the desktop or program menu, particularly if it is installed at the same time as another piece of apple software. Each of the times this happened I removed bonjour, using Windows Setup:Add/Remove programs, and then downloaded it again individually.
    If you have the same experience as me you'll then be asked if you want to install a shortcut to the printer wizard. The wizard has done the trick for me. I've not yet had to resort to the rather more complicated "add new printer" route.
    Message was edited by: puzzlebobble

  • We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader.

    We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader.
    For which, We created and execute the below command line to call Adobe Reader and print the PDF on a printer.
    "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" /T "\\<Application Server>\Report\<TEST.PDF>" "<Printer Name>".
    Current Situation: The above command line parameter when executed is working as expected in a User's Workspace.
    When executed in a command line on the Application Server, it is working as expected.
    But, the same is not working while executing it from Deployed environment.
    Software being used: 1. Adobe 11.0 enterprise version. 2. Webshpere Application Server 8.5.5.2.
    Please let us know if there is a way to enable trace logs in Adobe Reader to further diagnose this issue.

    This is the Acrobat.com forum.  Your question will have a much better chance being addressed in the Acrobat SDK forum.

  • We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader. For which, We created and execute the below command line to call Adobe Reader and print the PDF on a

    We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader. For which, We created and execute the below command line to call Adobe Reader and print the PDF on a printer."C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" /T "\\<Application Server>\Report\<TEST.PDF>" "<Printer Name>". Current Situation: The above command line parameter when executed is working as expected in a User's Workspace. When executed in a command line on the Application Server is working as expected. But, the same is not working while executing it from Deployed environment.Software being used: 1. Adobe 11.0 enterprise version. 2. Webshpere Application Server 8.5.5.2. Please let us know if there is a way to enable trace logs in Adobe Reader to further diagnose this issue.

    This is the Acrobat.com forum.  Your question will have a much better chance being addressed in the Acrobat SDK forum.

  • Connecting printer through wireless Print Server

    Wireless Dlink DPR-1260, hooked up to network. ( using Linksys wireless router and Windows XP Home)
    Two usb printer ports. Loaded HP laserjet 2300 series using the print server software wizard.. works fine...prints remotely.
    The P.S. created the tcp/ip ports and loaded the drivers after requesting the HP driver disk.
    But, when loading the HP color laserJet 2550 series, it asks for the disk, but says the driver inf files not available. I downloaded from the HP web site the XP drivers, and when I pointed to the unzipped files, said the same thing.
    I used the XP driver... should I have used the Universal Print Driver?
    On the P.S. screen the HP 2300 shows up as HP LaserJet 2300 series, and the LPR Queque name is : LaserJet 2300
    But when I manually loaded the 2550, The name shows up as HP color LaserJet 2550 ser and the Queque name is color LaserJet 25.
    Both printers work fine connected directly to the printer, but the 2550 will not print through the P.S.
    Since the drivers for the 2550 are loaded and it prints when hard wired, tell me how to find the drivers installed on the computer, so I can point to them there.
    Thanks

    Printing with the built-in network protocols (Windows Printing, IP printing) requires a CUPS print driver. HP doesn't provide CUPS drivers (yet) - their drivers are written to only use USB. You can try the HP Photosmart P1100 Gimp-Print driver included in OS X.
    There is no CUPS driver for your specific model, that I can find.

  • HP Photosmart Plus e-All-in-One Printer B210e Does Not Print Through Wireless

    I am using Mac OS X 10.7.3 on a wireless connection. I went to print, HP Utility gave me the following error message:
    The printer may not exist or is unavailable at this time
    It was not being used by anything else at the time. Then 2-3 minutes after I got that first error message HP Utility gave me another error message:
    The printer is not responding
    Then on the printer touch screen display I touched the wireless icon, chose Run Wireless Network Test, and got an error message:
    Load paper into Main Tray.
    The tray had plain white paper (10-15 sheets) in a nice neat stack as far back as it would go. I took the stack just to be sure it was still in a neat stack and put it in as far as it would go and pressed OK on the touch screen display and I still got the same message. Then I decide to turn the printer off using the power button, waited about a minute, and then pressed the power button to turn it on. When I did I got another error message:
    Improper Shutdown
    To avoid damage, use On button to shut down. Do not unplug the power cord or turn off the power outlet to shut down the device.
    How is that an improper shutdown when I did use the power button to turn it off.  Why is it telling me that I need to use the power button to turn it off then back on when I did use the power button to do that.  What is the issue and how do I fix it.  I did not have this issue with Mac OS X 10.7.2, but I do now agter the 10.7.3 update.  As of right now the only way I can print from Mac OS X is using a USB connection.  I can print through a wireless connection using my Windows 7 partition on the same MacBook.  I am starting to think that this printer is not Mac OS X 10.7 Lion compatible.
    I have a Time Capsule (3rd Generation) with the current firmware for it and the current the current AirPort Utility for Mac OS X installed.

    SthrnDixieCowgirl wrote:
    I don't know how to remove and add printers unless I had to format my hard drive for a completely different reason and reinstalled the printer that way.
    To remove the printer, open System Preferences > Print & Scan. You will see the HP in the Printers list. Click on it once to select it and then press the minus button under the Printers list to remove it.
    With this done, click the plus button under the Printers list to add the printer. With the Add Printer window open and the Default view selected, the HP should appear in this view. Select it and the Print Using menu should change to the supporting printer driver. When this happens, click the Add button to complete the creation of the printer queue.
    SthrnDixieCowgirl wrote:
    I have heard other people have issues with 10.7.3 for other reasons and I should have waited until 10.7.4 came out before updating and I didn't and now there is nothing I can do to go back to 10.7.2
    You cannot believe everything you read. For every person that had a problem after installing the .3 update, a hundred more had no problem.
    But if you wanted to go back to 10.7.2, then you can use Time Machine to do this. If you are not using Time Machine then you need to start doing so. At least the update only stopped you from network printing. What if it had stopped you from using the Mac?

  • I cannot get my new hp officejet pro 8500 a910 to print through my vmware fusion over my imac

    i cannot get my new hp officejet pro 8500 a910 to print through my vmware fusion over my imac's airport. My mac prints to this fine and the windows thinks it is printing but nothing. Please help with any suggestions.

    install full feature driver from HP website...
    Although I am working on behalf of HP, I am speaking for myself and not for HP.
    Love Kudos! If you feel my post has helped you please click the White Kudos! Star just below my name : )
    If you feel my answer has fixed your problem please click 'Mark As Solution' and make it easier for others to find help quickly : )
    Happy Troubleshooting : )

  • Finally able to print through Wireless Router!! (USR MaxG)

    So, after a full week of trying to get my printer to print wirelessly, I finally got it to work... but only after I had begun to write this post on the Apple Forums. So, since I felt like this post was extremely clear in the process, I'm posting it, in case anyone else has the same problem. I hope this helps someone, since it was impossible for me to find a post that really offered a clear explanation for how to print wirelessly...
    Here's my post:
    No matter what I do, I can't seem to print to my wireless router! Unless, that is, when I use my girlfriend's Windows computer. I'm able to print through the router to my printer via WinXP, but not OS X 1.4. Whenever I try to print in OS X, I get the error messages "Unable to find host..." or "Jobs Stopped."
    Here's my hardware:
    Router:
    U.S. Robotics Wireless MAXg Router (USR5461)
    Firmware: 3.93.35.0.6 (Jan 5 2006)
    Printer status: Ready
    Printer location: http://192.168.2.1:1631/printers/My_Printer
    Printer:
    Samsung ML-2510
    Computer:
    MacBook Pro
    OS X 10.4
    Here's what I've tried to do most recently:
    1) Applications> Utilities> Print Set Up Utility.
    2) Click "Add Printer" in Printer List
    3) Click "More Printers..." in print browser while holding down alt/option key
    4) Select "Advanced in Pull down menu
    5) Under Device, select Internet Printing Protocol using HTTP
    6) Under Device Name, insert "My_Printer" (listed above)
    7) Under Device URI, insert "http://192.168.2.1:1631/printers/My_Printer" (above)
    8) Under Printer Model, select "Samsung ML-2510 series"
    9) Click OK; make My_Printer default; and test print
    Results:
    (Printer actually prints) AMAZING!! I finally was able to get it to print. Apple forums is magical
    Hopes this helps.

    Thank you, thank you, thank you!!!!! I spent the past 3 hours trying to figure out why I couldn't get my mac to print on the wireless router. I found your posting about 2 hours into my quest, and it took me another hour to finally realize I needed to update the firmware on the router. I was using something from 2005, so when I installed the update, your directions worked! I never felt so happy to hear the printer! :-D
    If you hadn't posted this, I would have never figured it out...thanks again!

  • Buy a new hp deskjet ink advantage 3545e all-in-one printer through online portal. how to get the

    Regarding a new hp deskjet ink advantage 3545e all-in-one printer through online portal.
    how to get the free cartridge . do we need to register somewhere to get it. Any specific condition to get it.

    Hi @kandas1,
    I have brought your issue to the attention of an appropriate team within HP. They will likely request information from you in order to look up your case details or product serial number. Please look for a private message from an identified HP contact. Additionally, keep in mind not to publicly post serial numbers and case details.
    If you are unfamiliar with how the Forum's private message capability works, this post has instructions.
    Please click the Thumbs up icon below to thank me for responding.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Sunshyn2005 - I work on behalf of HP

Maybe you are looking for